Skip to content

DefaultCodegen: code-cleanup, propagate the openAPI instance #83

@jmini

Description

@jmini

In DefaultCodegen we have some methods that work with the current openAPI instance, other that do not.

We have methods that use Map<String,Schema> (corresponding to openAPI.getComponents().getSchemas()) => this corresponds to allDefinitions in a OAS2.

Now that Components in OAS3 is more than just the schemas, all methods should work with openAPI.


In particular:

The method public CodegenModel fromModel(String name, Schema schema) is really confusing. It is used a lot in the tests, but in reality public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions) is used.

We should remove public CodegenModel fromModel(String name, Schema schema) or if we keep it, give a more explicit name.

And all Unit-Tests should use: public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> allDefinitions) (or the adapted public CodegenModel fromModel(String name, Schema schema, OpenAPI openAPI) after the change described here)


We will need to refer to Components more and more. For example if we want to solve #8 we need to look at the referenced responses and requestBodies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions