Modelina is creating nested properties for patternProperties.
Example scheme, I have tried to made it as small as possible to isolate the bug
{
"type": "object",
"patternProperties": {
"^[\\w\\d\\.\\-_]+$": {
"oneOf": [
{
"$ref": "#/definitions/Reference"
},
{
"$ref": "#/definitions/messageObject"
}
]
}
},
"definitions": {
"Reference": {
"type": "object",
"description": "A simple object to allow referencing other components in the specification, internally and externally.",
"required": ["$ref"],
"properties": {
"$ref": {
"description": "The reference string.",
"$ref": "#/definitions/ReferenceObject"
}
},
"examples": [
{
"$ref": "#/components/schemas/Pet"
}
]
},
"ReferenceObject": {
"type": "string",
"format": "uri-reference"
},
"messageObject": {
"type": "object",
"description": "Describes a message received on a given channel and operation.",
"additionalProperties": false,
"properties": {
"contentType": {
"type": "string",
"description": "The content type to use when encoding/decoding a message's payload. The value MUST be a specific media type (e.g. application/json). When omitted, the value MUST be the one specified on the defaultContentType field."
}
}
}
}
}
This scheme is generating this root object
package models
// Root represents a Root model.
type Root struct {
ModelinaAnyType interface{}
PatternProperty_0
}
// pattern_property_0.go
package models
// PatternProperty_0 represents a PatternProperty_0 model.
type PatternProperty_0 struct {
Reference
MessageObject
}
Expected behavior
Should not have ModelinaAnyType interface{} in the root object and use pattern_property_0 in root itsef.
Describe the bug.
Modelina is creating nested properties for
patternProperties
.Example scheme, I have tried to made it as small as possible to isolate the bug
This scheme is generating this root object
Expected behavior
Should not have
ModelinaAnyType interface{}
in the root object and usepattern_property_0
in root itsef.Screenshots
I have pushed my code on github, if anyone wanna check it out https://github.com/Souvikns/modelina-bug
How to Reproduce
To reproduce this we have install
"@asyncapi/modelina": "v4.0.0-next.45"
and create a script to usego
file generator to useGO_COMMON_PRESET
.installed
🥦 Browser
Mozilla Firefox
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
Yes I am willing to submit a PR!