Hi
Sorry, we're still having a problem with some change between 0.50 and 0.51.
I think this is related/similar to #2796, which is fixed but it seems to be some more corners.
I've tested it with the @next tsp npm packages.
This typespec will in the latest version generate the nested/recursive field as allOf and redocly complains with:
Prerendering docs
Incompatible types in allOf at "#/components/schemas/FilterNode/properties/childNodes": "object" and "array"
allOf: schemas with different types can't be merged
OpenAPI Sampler: found allOf with "array" type. Result may be incorrect
the typespec
import "@typespec/rest";
import "@typespec/openapi3";
using TypeSpec.Http;
using TypeSpec.Rest;
model FilterNode
{
someField: string;
childNodes: FilterNode[] | null; // note e.g. that the ' | null ' here affects, and the post op further down.
}
model QueryParams
{
filters: FilterNode[] | null;
}
@post op TheSearch(...QueryParams): {}[];
yaml part:
childNodes:
type: object
allOf:
- type: array
items:
$ref: '#/components/schemas/FilterNode'
nullable: true
Hi
Sorry, we're still having a problem with some change between 0.50 and 0.51.
I think this is related/similar to #2796, which is fixed but it seems to be some more corners.
I've tested it with the @next tsp npm packages.
This typespec will in the latest version generate the nested/recursive field as allOf and redocly complains with:
the typespec
yaml part: