Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x-namespaced-enum not generating correctly when using Swagger-CodeGen #13

Open
nimble-software opened this issue Mar 3, 2020 · 2 comments

Comments

@nimble-software
Copy link

Hi,

Problem:

When using swagger-codegen to generate server or client code using the open banking specs, the use of the x-namespaced-enum property as opposed to just enum is causing the code to generate incorrectly.

Description

When using the enum property the code generator correctly creates the enum and references the enum in the appropriate class i.e. in OBAccount3 the accountType and accountSubType fields correctly reference the generated enums, i.e.

  @JsonProperty("AccountType")
  private OBExternalAccountType1Code accountType = null;

  @JsonProperty("AccountSubType")
  private OBExternalAccountSubType1Code accountSubType = null;

However when the x-namespaced-enum property is used the class that references that property simply has it's field defined as a String. An example of this can be seen in the OBBranchAndFinancialInstitutionIdentification5 class, where the schemeName property is a String as opposed to an actual enum i.e.

@JsonProperty("SchemeName")
private String schemeName = null;

Question

Has a vendor extension been created that will allow the code generator to correctly create and reference the appropriate enum class, as opposed to just defining a String?

@mbana
Copy link

mbana commented Mar 4, 2020

Have you had a look at swagger-api/swagger-codegen#9020? It looks very similar (I know it says Swift4 in the title).

@nitin-tiwari
Copy link
Contributor

nitin-tiwari commented Mar 16, 2020

@nimble-software
Properties tagged with format - x-namespaced-enum are not Statically Typed enum.
The data type of the field is String, to allow API Provider to extend upon it without breaking the client implementations.
In earlier release, the enums were listed in examples attribute of OpenAPI Schema, which essentially they are.
Functionally such types in OB UK ecosystem are called Namespaced Enumerations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants