-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapper/Model to handle anyOf over VirtualCircuit and VrfVirtualCircuit #58
Comments
@ctreatma Is this something that you noticed improvement with in the attempt to use redoc-cli for stitching? |
No, switching to redoc for bundling wouldn't have an impact here. For this sort of thing, we need to extract the For example, we could create a file oneOf:
- $ref: '../../../../../components/schemas/VirtualCircuitCreate.yaml'
- $ref: '../../../../../components/schemas/VrfVirtualCircuitCreate.yaml' Given that file, we would update the VirtualCircuitList schema and the operation snippet in the issue description as follows: properties:
virtual_circuits:
items:
$ref: './OneOfVirtualCircuit.yaml
type: array
type: object requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '../../../../../components/schemas/VirtualCircuitCreateInput.yaml'
- $ref: '../../../../../components/schemas/VrfVirtualCircuitCreateInput.yaml'
description: Virtual Circuit details
required: true
responses:
"201":
content:
application/json:
schema:
$ref: '../../../../../components/schemas/OneOfVirtualCircuit.yaml' That change would replace both the |
More broadly, we need to establish a pattern/practice of avoiding nested |
This updates the virtual circuit schemas to address #58. The existing VirtualCircuit schema is renamed to VlanVirtualCircuit, and a new VirtualCircuit schema is added that represents either a VlanVirtualCircuit or a VrfVirtualCircuit.
We have multiple models/schema representing anyOf structure between VirtualCircuit and VrfVirtualCircuit.
VirtualCircuitList in non-stitched oas 3.0 as following schema structure :
ref : https://github.com/equinix-labs/metal-java/blob/main/spec/oas3.fetched/openapi/public/components/schemas/VirtualCircuitList.yaml
Whereas after stitching it with openapi generator we get following :
ref : https://github.com/equinix-labs/metal-java/blob/main/spec/oas3.stitched/oas3.stitched.metal.yaml#L13421
Same is visible in create request and response schema :
ref: https://github.com/equinix-labs/metal-java/blob/main/spec/oas3.fetched/openapi/public/paths/connections/connection_id/ports/port_id/virtual-circuits.yaml#L62
Stitched flavour :
ref : https://github.com/equinix-labs/metal-java/blob/main/spec/oas3.stitched/oas3.stitched.metal.yaml#L1088
createInterconnectionPortVirtualCircuit_201_response
andVirtualCircuitList_virtual_circuits_inner
in stitched spec represent the same schema modelling and is generated as a result of anyOf not being wrapped in a model before consumption. This creates inconsistent flavours when java bindings are generated.Such example exists in multiple other places and should be rectified :
The text was updated successfully, but these errors were encountered: