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

Code clean-up: refactor CodegenResponse, CodegenProperty and CodegenParameter #20

Open
jmini opened this issue May 13, 2018 · 4 comments

Comments

@jmini
Copy link
Member

jmini commented May 13, 2018

CodegenResponse, CodegenProperty and CodegenParameter are very similar, but for the moment they to not share nothing.

With OAS2 specification, it made sense to have three objects because every of these concepts was different in the spec. Now with OAS3, everything is Schema based. But in our methods fromModel(..), fromProperty(..) and fromResponse(..) reimplement everything three times…

The first step will be to identify what is common between CodegenResponse, CodegenProperty and CodegenParameter. A new abstract Codegen should be created: AbstractSchemaBasedCodegen (or something like that). It contains the common stuff and it is derived from the schema.

Then we will be able to remove the redundancy in DefaultCodegen and we will have something that works the same way for consumers of CodegenResponse, CodegenProperty and CodegenParameter.

@jmini
Copy link
Member Author

jmini commented May 15, 2018

As a first step, we should ensure consistency between the properties of each Codegne. For example:

  • org.openapitools.codegen.CodegenModel.dataType
  • org.openapitools.codegen.CodegenParameter.dataType
  • org.openapitools.codegen.CodegenResponse.dataType
  • org.openapitools.codegen.CodegenProperty.datatype

datatype should be renamed dataType in the code and in the templates => #69

@jmini
Copy link
Member Author

jmini commented May 17, 2018

An other related topic, we need access to the openAPI instance, see #83

@jmini
Copy link
Member Author

jmini commented May 22, 2018

Discussed in #75, CodegenModel needs isInteger similar to CodegenProperty.

@cvgaviao
Copy link

cvgaviao commented Jan 2, 2021

As a first step, we should ensure consistency between the properties of each Codegne. For example:

* `org.openapitools.codegen.CodegenModel.dataType`

* `org.openapitools.codegen.CodegenParameter.dataType`

* `org.openapitools.codegen.CodegenResponse.dataType`

* `org.openapitools.codegen.CodegenProperty.datatype`

datatype should be renamed dataType in the code and in the templates => #69

Hi, could you explain me please the reason those classes do not have a complexType property as has a CodegenProperty (in other to have both the base collection type and its inner type)?

aserkes pushed a commit to aserkes/openapi-generator that referenced this issue May 26, 2022
nilskuhn pushed a commit to nilskuhn/openapi-generator that referenced this issue Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants