openapi-contrib / openapi3-generator

Use your API OpenAPI 3 definition to generate code, documentation, and literally anything you need.
Apache License 2.0
89 stars 27 forks source link

#ref in additional properties #27

Closed fiddlededee closed 5 years ago

fiddlededee commented 5 years ago

Hi. I try to make a template for asciidoc (asciidoctor, in fact). With test examples everythin is great. But I faced the following problem.

Here is the part of specification:

    ModelMetaData:
      required:
        - members
        - attributes
      properties:
        members:
          description:
            Meta data for members
          additionalProperties: # key - memberId
            $ref: '#/components/schemas/MemberMetaData'
        attributes:
          description:
            Meta data for attributes
          additionalProperties: # key - attributeId
            $ref: '#/components/schemas/AttributeMetaData'

    MemberMetaData:
      required:
        - text
      properties:
        text:
          description:
            id of the member as a text
          type: string
        aggregateText:
          description:
            aggregate of the member as a text
          type: string
        formulaeText:
          description:
            formulae of the member as a text
          type: string

    AttributeMetaData:
      required:
        - text
      properties:
        text:
          description:
            id of the attribute as a text
          type: string

In the resulting table I get summaryAsHTML, descriptionAsHTML and generatedExample as extra rows and get empty descriptions.

image

The same problem is with Markdown template.

Here is the template code, that iterates through properties:

{{#each prop.additionalProperties.properties}}
{{> schemaProp prop=. propName=@key required=(isRequired ../prop.additionalProperties @key) path=(buildPath ../propName ../path @key)}}
{{/each}}

If the problem can be fixed in a template, just give a hint, I'll make PR for Markdown and if you don't mind I can make PR for asciidoc template.

fiddlededee commented 5 years ago

Probably, solved this in #28

fmvilas commented 5 years ago

Fixed in #28.