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

schemas are blank in html2 generatation #3788

Closed
jcald1 opened this issue Aug 28, 2019 · 7 comments · Fixed by #18356
Closed

schemas are blank in html2 generatation #3788

jcald1 opened this issue Aug 28, 2019 · 7 comments · Fixed by #18356

Comments

@jcald1
Copy link

jcald1 commented Aug 28, 2019

I pulled the latest openapitools/openapi-generator-cli Docker image: 193486a2ca74

Command:

docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli generate -i openapi.yaml -g html2

Opened the generated index.html file and saw that all of the schemas were blank. When I ran the html2 generator in https://github.com/swagger-api/swagger-codegen, the schemas were populated.

openapi.yaml:
https://raw.githubusercontent.com/PresencePG/grip-server/feature/time-series/documentation/openapi.yaml?token=ABKWFWZBSGDI6FYD4JA4IWS5OAR5Q

@auto-labeler
Copy link

auto-labeler bot commented Aug 28, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@JogoShugh
Copy link

Any updates on this? I see the same behavior.

@bachorp
Copy link
Contributor

bachorp commented Mar 11, 2021

I ran into the problem that a single schema was blank. In my case this was fixed by turning

... :
    schema:
        $ref: '#/components/schemas/X'
components:
    schemas:
        X:
            type: array
            items:
                $ref: '#/components/schemas/Y'
        Y:
            ...

into

... :
    schema:
        type: array
        items:
            $ref: '#/components/schemas/Y'
components:
    schemas:
        Y:
            ...

This might be related to this issue.
The first snippet used to work, however, in an old version of openapi-generator. So there seems to be a regression.

@nmandya
Copy link

nmandya commented May 31, 2021

Any update on this? I am facing the same issue too.

@haydenm315
Copy link

haydenm315 commented Aug 9, 2022

Any update on this? I am facing the same issue too.

May want to try openapigenerator version 6.0.0. Something broke starting with 6.0.1 regarding schema refs when using the html2 generator. #12842
It's still broken in 6.0.2

@lrittel
Copy link

lrittel commented Oct 4, 2022

This also happened to me on version 6.2.0 (from the Arch repositories), but without using any references.
Here is a (sort of) minimal example that results in empty schemas:

openapi: 3.0.3
info:
  title: Minimal example
  description: |-
    description …
  contact:
    email: [email protected]
  license:
    name: proprietary
    # url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 0.1
paths:
  /test:
    post:
      operationId: test
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  enabled:
                    type: boolean
        '405':
          description: Some reason
      security: []

I build the documentation with:

$ openapi-generator-cli generate -i example.yaml -g html2 -o output

There is an empty box shown where I'd expect the template to be.
Moving the schema into a request works as expected.

Edit: Here is the output of the command:

[main] INFO  o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: html2 (documentation)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'html2' is considered stable.
[main] INFO  o.o.codegen.InlineModelResolver - Inline schema created as test_200_response. To have complete control of the model name, set the `title` field or use the inlineSchemaNameMapping option (--inline-schema-name-mapping in CLI).
[main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO  o.o.codegen.TemplateManager - writing file /home/$USER/tmp/2022-10-04 openapi-minimal-example-test/output/index.html
[main] INFO  o.o.codegen.TemplateManager - Skipped /home/$USER/tmp/2022-10-04 openapi-minimal-example-test/output/.openapi-generator-ignore (Skipped by supportingFiles options supplied by user.)
[main] INFO  o.o.codegen.TemplateManager - writing file /home/$USER/tmp/2022-10-04 openapi-minimal-example-test/output/.openapi-generator/VERSION
[main] INFO  o.o.codegen.TemplateManager - writing file /home/$USER/tmp/2022-10-04 openapi-minimal-example-test/output/.openapi-generator/FILES
################################################################################
# Thanks for using OpenAPI Generator.                                          #
# Please consider donation to help us maintain this project 🙏                 #
# https://opencollective.com/openapi_generator/donate                          #
################################################################################

(I have replaced my user name with $USER)

@lrittel
Copy link

lrittel commented Oct 4, 2022

And I did some further testing. The example above is broken in version 6.0.1 but works in 6.0.0. So it seems to be a regression in version 6.0.1.
Both version were from the Arch Package Archive (if that matters).
I don't have the time to investigate further atm. For now, I'll stay at 6.0.0, but going forward, I can see this becoming a deal breaker for me :/ .

Oh and I forgot to mention that examples are not rendered as well (yes, the example given above does not include one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants