Skip to content

[cwiki] Models section does not output all fields correctly #1277

@ndjensen

Description

@ndjensen
Description

If you use the cwiki generator, there are two problems in the Models table at the bottom of the generated Confluence wiki markup. First, the required column is not checked when required: true. Second, the description is not filled in when referencing another component such as $ref: "/#components/schemas/Error"

openapi-generator version

Version 3.3.1.

OpenAPI declaration file content or url

Modified petstore.yaml. Change the components section to be:

components:
  schemas:
    Pet:
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
          description: Id of the pet
        name:
          type: string
          description: Name of the pet
        tag:
          type: string
          description: Tag of the pet
        msg:
          $ref: "#/components/schemas/Error"
          description: Message of the pet
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
Command line used for generation

java -jar openapi-generator-cli.jar generate -i ~/test_openapi/petstore.yaml -g cwiki -o ~/openapi-output/petstoreCWiki

Steps to reproduce
  1. Make a yaml file that has at least two components.
  2. Make at least one of the properties on a component required. (In the example above, note that both Pet and Error have required properties).
  3. Make one of the components have a property of the other component. Add a description to that property. (In the example above, Pet has a msg property of component Error and the msg property has a description).
  4. Run the cwiki generator.
  5. Note that the Models table at the bottom does not have the checkbox(es) for the required property/properties.
  6. Note that the description of the property of the other component type is not listed in the description column. (The other description rows are fine).
Related issues/PRs
Suggest a fix/enhancement

I think something is wrong in the mustache template, but I don't know.

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