You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openapi: 3.0.2info:
title: Helloversion: 1.0.0components:
schemas:
String1:
type: stringdefault: Hello1minLength: 22$inline: "#/components/schemas/String2"Array1:
type: arrayitems:
type: stringnullable: TrueString2:
type: stringtitle: String2000default: Hello2$inline: '#/components/schemas/String3'String3:
default: Hello3description: 'My name is string1.raml'$inline: '#/components/schemas/String4'String4:
default: Hello4enum:
- Hello
- World
- Whypaths:
/pets:
get:
description: Returns all pets from the system that the user has access toresponses:
'200':
description: A list of pets.content:
application/json:
schema:
$ref: '#/components/schemas/String1'/cats2:
get:
description: Returns all pets from the system that the user has access toresponses:
'200':
description: A list of pets.content:
application/json:
schema:
$ref: '#/components/schemas/String2'/cats3:
get:
description: Returns all pets from the system that the user has access toresponses:
'200':
description: A list of pets.content:
application/json:
schema:
$ref: '#/components/schemas/String3'/cats4:
get:
description: Returns all pets from the system that the user has access toresponses:
'200':
description: A list of pets.content:
application/json:
schema:
$ref: '#/components/schemas/String4'
When ran with the preprocessor, here is the output.
{
"components": {
"schemas": {
"String1": {
"$inline": "#/components/schemas/String3",
"default": "Hello1",
"minLength": 22,
"title": "String2000",
"type": "string"
},
"String2": {
"default": "Hello2",
"description": "My name is string1.raml",
"enum": [
"Hello",
"World",
"Why"
],
"title": "String2000",
"type": "string"
},
"String3": {
"default": "Hello3",
"description": "My name is string1.raml",
"enum": [
"Hello",
"World",
"Why"
]
},
"String4": {
"default": "Hello4",
"enum": [
"Hello",
"World",
"Why"
]
}
}
},
"info": {
"title": "Hello",
"version": "1.0.0"
},
"openapi": "3.0.2",
"paths": {
"/cats2": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/String2"
}
}
},
"description": "A list of pets."
}
}
}
},
"/cats3": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/String3"
}
}
},
"description": "A list of pets."
}
}
}
},
"/cats4": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/String4"
}
}
},
"description": "A list of pets."
}
}
}
},
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/String1"
}
}
},
"description": "A list of pets."
}
}
}
}
}
}
Notice that in the schema with name String1, the inline reference to String3 was not resolved. This is curious, because it seemed to work appropriately for String2. Perhaps your code only handles nested inlines when not on the first layer?
The text was updated successfully, but these errors were encountered:
Inlining just resolves nodes in place. Without processing anything. Which means once a node is inlined, it will affect how the rest of the document is processed.
So you're right. Deep inlining is not supported.
However, $merge supports deep merging. So not implementing deep inlining is by design: we don't need two tools that would do the same thing (the only difference is how deep overrides are specified).
So the workaround here is to replace all your uses of $inline with $merge because deep merging is safely handled.
Consider the following OAS yaml
When ran with the preprocessor, here is the output.
Notice that in the schema with name String1, the inline reference to String3 was not resolved. This is curious, because it seemed to work appropriately for String2. Perhaps your code only handles nested inlines when not on the first layer?
The text was updated successfully, but these errors were encountered: