Giter VIP home page Giter VIP logo

openair's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

openair's Issues

Use OpenAir table names for generating readers

Currently the "cleaned" name is used in the generated code, while the raw name is used to fetch columns. This causes issues when adding OpenAir tables which have inconsistent names.

The fix: (we don't have the ability to create branches in this repository, so here's a patch instead!)

From 252e3a82dd0a3cc4c2194a4391535d66228133cd Mon Sep 17 00:00:00 2001
From: David Evans <[email protected]>
Date: Fri, 30 Jun 2017 10:19:56 +0100
Subject: [PATCH 15/15] Fix OpenAir table names; now consistent between
 generated source and name used to scan for columns

Signed-off-by: Daniela Bulgaru <[email protected]>
---
 generator/openair.go  | 2 ++
 generator/template.go | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/generator/openair.go b/generator/openair.go
index 42515d1..7c9953c 100644
--- a/generator/openair.go
+++ b/generator/openair.go
@@ -158,10 +158,12 @@ func (g *generator) GenerateModelFiles() {
 		fields := buildFields(datatype)
 		var context = struct {
 			PackageName string
+			OpenAirName string
 			TypeName    string
 			Fields      []field
 		}{
 			PackageName: g.pkg,
+			OpenAirName: datatype,
 			TypeName:    name,
 			Fields:      fields,
 		}
diff --git a/generator/template.go b/generator/template.go
index a5e17d8..e22a315 100644
--- a/generator/template.go
+++ b/generator/template.go
@@ -131,7 +131,7 @@ type {{cleanname .TypeName}}Response struct {
 // {{cleanname .TypeName}}Read is a container for {{cleanname .TypeName}}
 type {{cleanname .TypeName}}Read struct {
 	Status    string     {{xmltag "status,attr"}}
-	{{cleanname .TypeName}}s []{{cleanname .TypeName}} {{xmlrawtag .TypeName}}
+	{{cleanname .TypeName}}s []{{cleanname .TypeName}} {{xmlrawtag .OpenAirName}}
 }

 type {{cleannamelower .TypeName}} struct {
@@ -162,7 +162,7 @@ func (o *{{cleannamelower .TypeName}}) list(ctx context.Context, limit int, offs
 					<password>%s</password>
 				</Login>
 			</Auth>
-			<Read type="{{.TypeName}}" method="all" limit="%d,%d" enable_custom="1" include_nondeleted="1" deleted="1" %s>%s</Read>
+			<Read type="{{.OpenAirName}}" method="all" limit="%d,%d" enable_custom="1" include_nondeleted="1" deleted="1" %s>%s</Read>
 		</request>{{backtick}}

 	payload := strings.NewReader(fmt.Sprintf(tmpl, o.config.Namespace, o.config.Key, o.config.Company, o.config.User, o.config.Password, offset, limit, filterAttributes, filterBody))
--
2.13.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.