autorest
autorest copied to clipboard
Investigate properties with allOf to a ref
In openapi you cannot use any properties next to a $ref``. Autorest does allow a few to be able to be used on model properties like description, readonly`, etc.
Foo:
name:
readOnly: true
$ref: "#components/schemas/name"
However it should really be defined this way
Foo:
name:
readOnly: true
allOf:
- $ref: "#components/schemas/name"
Autorest does support this but needs a flag to be enabled --modelerfour.remove-empty-child-schemas and will log warnings.
Believe we can be smart and figure out when this pattern is used and not log any warnings and remove the need for the flag.
One more thing to investigate:
"foo": {
"allOf": [
{
"$ref": "#/components/schemas/Foo"
}
],
"nullable": true
}
Produces this code - ignores nullabe: true:
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}