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
  • #6150
Closed
Open
Issue created May 03, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Core] No "type" property in {{modelJson}} of inline response

Created by: ybelenko

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Variable {{modelJson}} isn't complete for inline responses right now(maybe even for all inline schemas). When I launch any generator with -DdebugModels option the output is:

[main] INFO  o.o.codegen.DefaultGenerator - ############ Model info ############
[ {
  "importPath" : "InlineResponse200",
  "model" : {
    "anyOf" : [ ],
    "oneOf" : [ ],
    "allOf" : [ ],
    "name" : "inline_response_200",
    "classname" : "InlineResponse200",
    "classVarName" : "inlineResponse200",
    "modelJson" : "{\n  \"properties\" : {\n    \"foo\" : {\n      \"type\" : \"string\"\n    },\n    \"bar\" : {\n      \"type\" : \"string\"\n    }\n  }\n}",
    "dataType" : "Object",
    "classFilename" : "InlineResponse200",

It's wrong, because produced schema is invalid(type is required property) and I've set type property in original spec file. Spec file provided below.

openapi-generator version

4.3.1-SNAPSHOT

OpenAPI declaration file content or url
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Test inline response model
  description: Test inline response model.
  license:
    name: MIT
paths:
  /foobar:
    get:
      summary:  No type property in modelJson of InlineResponse200.
      operationId: testOperation
      description: No type property in modelJson of InlineResponse200
      responses:
        200:
          description: InlineResponse200 itself.
          content:
            application/json:
              schema:
                type: object
                properties:
                  foo:
                    type: string
                  bar:
                    type: string
Command line used for generation

Any generator with -DdebugModels option.

Steps to reproduce

Run any generator with option above.

Suggest a fix

{{modelJson}} variable of inline response model should contain type property, because it exists in source spec file.

Assignee
Assign to
Time tracking