Closed avwie closed 7 months ago
Fabrikt does not support this kind of definition:
version:
type:
- string
- 'null'
Okay. How could I’ve found that out? And, is it documented somewhere?
Fabrikt was only built to support OpenApi 3.0 The OpenApi 3.1 specification made some breaking changes to 3.0, this is one of them. I have created this little hack to fix it: https://github.com/cjbooms/fabrikt/pull/263
I have created two PRs which improve support for this API. However, there is a pretty crazy amount of inlining of schema definitions, and the synthetic schema names that Fabrikt is generating are conflicting with each other.
When fabrikt sees an inlined object, it uses the top-level enclosing schema as the prefix, and the property name as the suffix when generating the data classes. Example:
Dog:
type: object
properties:
walker:
allOf:
- $ref: "#/components/schemas/Person"
- $ref: "#/components/schemas/Company"
Will result in a synthetic schema name of DogWalker
. If the Dog object has another nested properties, called walker, that also defines an inlined object, it will result in the same synthetic DogWalker
schema name. eg:
Dog:
type: object
properties:
walker:
allOf:
- $ref: "#/components/schemas/Person"
- $ref: "#/components/schemas/Company"
owner:
type: object
properties:
walker:
allOf:
- $ref: "#/components/schemas/Person"
I'm closing this issue as I have fixed what issues I could. To enable generation, the JsDelivr API will need to be restructured to extract some of the inlined schemas into top-level schemas. This can be achieved without changing the contract of the API
I am trying to generate https://data.jsdelivr.com/v1/spec.yaml, however it fails for Fabrikt on:
However, using the OpenApiTools Kotlin generator it works. I am unable to find any external schema reference in the code.