SDK Error
ARM and Data plane OpenAPI(swagger) specs
Inline/anonymous models must not be used, instead define a schema with a model name in the "definitions" section and refer to it. This allows operations to share the models.
This rule appears when you define a model type inline, rather than in the definitions section. If the model represents the same type as another parameter in a different operation, then it becomes impossible to reuse that same class for both operations.
Anonymous parameters will be autogenerated as non-descriptive parameters which the client will not be able to share across operations or provide good documentation for, thereby resulting in poor user experience.
Move the schema to the definitions section and reference it using $ref.
Before
Spec:
…
"parameters":[
{
"name": "foo",
"in": "body",
"schema": {
"type": "object",
"properties": {
…
}
}
}
]
…
Generated code:
public class FooParameter1 {
…
}
After
Spec:
…
"parameters": [
{
"name": "foo",
"in": "body",
"schema": {
"$ref": "#/definition/FooCreationSettings"
}
}
],
…
"definitions": {
"FooCreationSettings": {
"type": "object",
"properties": {
…
}
}
}
…
Generated code:
public class FooCreationSettings {
…
}
N/A.