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

[Ada] Update the code generator for required and optional parameters #210

Closed
stcarrez opened this issue Jun 3, 2018 · 0 comments
Closed

Comments

@stcarrez
Copy link
Contributor

stcarrez commented Jun 3, 2018

Description

The required parameters are no longer managed correctly in the OpenAPITools 3.0 generator.
(The AdaCode generator needed some update).

By default, all parameters are declared as if they are optional and the Ada code generator
uses the Nullable_T type.

openapi-generator version

3.0.0

OpenAPI declaration file content or url
    Ticket:
      type: object
      properties:
        id:
          type: integer
          format: int64
        title:
          type: string
          description: Title of the ticket
        description:
          type: string
          description: Description of the ticket
      required:
        - id
        - title
      title: Information about a ticket

With the above type, the 'title' should use the type Swagger.UString but it uses Swagger.Nullable_UString.

Command line used for generation

java -jar openapi-generator-cli.jar generate
--generator-name ada -i regtests/swagger.yaml -o regtests/client
-DprojectName=TestAPI --model-package TestAPI

Suggest a fix/enhancement

The required support was handled in the getTypeDeclaration() operation and this is no longer possible.
The postProcessModels() and postProcessOperations() must take into account the required property
of each parameter and update the parameter/member dataType accordingly.

stcarrez added a commit to stcarrez/openapi-generator that referenced this issue Jun 3, 2018
…d optional parameters

- Do not check for required parameter in getTypeDeclaration()
- Update the nullableTypeMapping map to map an Ada type into a corresponding
  Nullable_<T> Ada type that allows the value to be null
- Check for optional parameter in postProccessOperations() and postProcessModels()
  to replace the Ada type into an Ada type that supports null values
@wing328 wing328 closed this as completed in 967cc5b Jun 5, 2018
jimschubert added a commit to jimschubert/openapi-generator that referenced this issue Jun 8, 2018
* master:
  Add 'unblu inc.' to company list (OpenAPITools#246)
  put company list in alphabetical order (OpenAPITools#244)
  [jaxrs-spec] generate spec file (yaml) correctly (OpenAPITools#243)
  [C++] Adjust the names (script, sample folder, generator) to lang option (OpenAPITools#220)
  Add GMO Pepabo to company list (OpenAPITools#242)
  [Spring] Add apiFirst option (OpenAPITools#184)
  [cli] Write to stdout/stderr, allow redirection (OpenAPITools#207)
  [JAVA][Client] New object instead of null for empty POST request (OpenAPITools#98)
  Make yaml serialization deterministic (OpenAPITools#233)
  Add syntax highlighting to migration guide (OpenAPITools#237)
  Fix shippable badge (OpenAPITools#232)
  update company list (OpenAPITools#227)
  Fix OpenAPITools#210: [Ada] Update the code generator for required and optional parameters (OpenAPITools#211)
  Delete unused methods in DefaultCodegen (OpenAPITools#209)
  add note about maven plugins (OpenAPITools#216)
  add raiffeisen to company list (OpenAPITools#223)
  add a remark about homebrew installatio (OpenAPITools#217)
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