Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public Schema modelFromProperty(ObjectSchema object, String path) {
model.setExample(example);
model.setName(name);
model.setXml(xml);
model.setType(object.getType());

if (properties != null) {
flattenProperties(properties, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses;
import io.swagger.v3.parser.OpenAPIV3Parser;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.testng.annotations.Test;


Expand All @@ -29,6 +31,17 @@

@SuppressWarnings("static-method")
public class InlineModelResolverTest {

@Test
public void testIssue705() throws Exception {
ParseOptions options = new ParseOptions();
options.setFlatten(true);
OpenAPI openAPI = new OpenAPIV3Parser().read("issue-705.yaml",null, options);
assertNotNull(openAPI);
assertNotNull(openAPI.getComponents().getSchemas().get("inline_response_200").getType());
}


@Test
public void resolveInlineModelTestWithoutTitle() throws Exception {
OpenAPI openAPI = new OpenAPI();
Expand Down
41 changes: 41 additions & 0 deletions modules/swagger-parser-v3/src/test/resources/issue-705.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
openapi: 3.0.0
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
paths:
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: An paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string