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

[ALL] Return value of getSchemaType() is unclear/inconsistent #317

Open
skrysmanski opened this issue Feb 24, 2019 · 0 comments
Open

[ALL] Return value of getSchemaType() is unclear/inconsistent #317

skrysmanski opened this issue Feb 24, 2019 · 0 comments

Comments

@skrysmanski
Copy link
Contributor

The interpretation of the return value of DefaultCodegenConfig.getSchemaType() is unclear.

Both the implementation of the method and its documentation suggest that this method should return Swagger types (e.g. integer, file, ...).

However, at least some usages suggest that it should return language types (e.g. int, File, ...).

So far, I've identified two places which such problems:

Problem 1: addImport()

In fromProperty() the field baseType is set like this:

codegenProperty.baseType = getSchemaType(propertySchema);

And then later in addVars() that baseType is used to add an import:

addImport(codegenModel, cp.baseType);

However, addImport() seems to expect a language type, not a swagger type.

Problem 2: toInstantiationType()

In toInstantiationType() the method is used like this:

String inner = getSchemaType(additionalProperties);
return instantiationTypes.get("map") + "<String, " + inner + ">";

This code clearly expects a language type (or Java-like type) - not a Swagger type.

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

1 participant