Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #409
Closed
Open
Issue created Jun 27, 2018 by Administrator@rootContributor

[HTML] Does not accept additionalProperties flag for a schema within requestBody.

Created by: sri3390

Description

Currently the html generation fails for schemas that have the field additionalProperties mentioned within requestBody schema for openapi v3 with the exception:

[main] WARN  o.o.codegen.utils.URLPathUtils - 'host' not defined in the spec (2.0). Default to http://localhost
Exception in thread "main" java.lang.RuntimeException: Could not process model 'body_4'.Please make sure that your schema is correct!
	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:398)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:783)
	at org.openapitools.codegen.cmd.Generate.run(Generate.java:315)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:58)
Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to io.swagger.v3.oas.models.media.Schema
	at org.openapitools.codegen.languages.StaticHtmlGenerator.getTypeDeclaration(StaticHtmlGenerator.java:121)
	at org.openapitools.codegen.DefaultCodegen.fromProperty(DefaultCodegen.java:1782)
	at org.openapitools.codegen.DefaultCodegen.addParentContainer(DefaultCodegen.java:2970)
	at org.openapitools.codegen.DefaultCodegen.addAdditionPropertiesToCodeGenModel(DefaultCodegen.java:1539)
	at org.openapitools.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:1523)
	at org.openapitools.codegen.DefaultGenerator.processModels(DefaultGenerator.java:1016)
	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:393)
	... 3 more

openapi-generator version

3.0.2, 3.0.3

OpenAPI declaration file content or url

https://gist.github.com/sri3390/18907fb14ad3b909eb6dd44c7036d80b

Command line used for generation

java -jar openapi-generator-cli-3.0.3-20180626.073419-19.jar generate -i openapi.json -g html -o /test

Steps to reproduce Copy the json file linked and run the above command.

This works fine if we remove the flag defined here: https://gist.github.com/sri3390/18907fb14ad3b909eb6dd44c7036d80b#file-sample-json-file-L38.

This also works fine if additionalProperties is present in the response schemas.

Assignee
Assign to
Time tracking