[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( I've set type
is required property) andtype
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.