How to Inline all objects except the circular refranced one #426
-
if I have a schema like this {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"MessageDto": {
"type": "object",
"properties": {
"ackDateTime": {
"type": "string"
},
"orderResponseStatusList": {
"type": "array",
"items": {
"$ref": "#/definitions/OrderResponseStatusDto"
}
}
}
},
"OrderResponseStatusDto": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"message": {
"$ref": "#/definitions/MessageDto"
}
}
}
},
"type": "object",
"properties": {
"message": {
"$ref": "#/definitions/MessageDto"
}
}
} how to skip resolving MessageDto that inside OrderResponseStatusDto |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @mohammed6688, Your example looks like it was created with Why can't you use the default behaviour (with neither of these two Other than that default behaviour, there is no built-in mechanism to just create definitions for the circularly referenced types (yet 😉). |
Beta Was this translation helpful? Give feedback.
Hi @mohammed6688,
Your example looks like it was created with
Option.DEFINITIONS_FOR_ALL_OBJECTS
and you consider usingOption.INLINE_ALL_SCHEMAS
(which gives you an error due to the circular reference).Why can't you use the default behaviour (with neither of these two
Option
values being enabled)? That would only produce definitions when the same type is referenced more than once. In your example: just theMessageDto
.Other than that default behaviour, there is no built-in mechanism to just create definitions for the circularly referenced types (yet 😉).
There'd be a way to manually force it through advanced configurations, if you you know the affected types upfront.