joefitzgerald / openair Goto Github PK
View Code? Open in Web Editor NEWA go generator for the OpenAir XML API
License: Other
A go generator for the OpenAir XML API
License: Other
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.