Skip to content
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

Reference objects for update property #29

Open
adamaltman opened this issue Oct 10, 2023 · 1 comment
Open

Reference objects for update property #29

adamaltman opened this issue Oct 10, 2023 · 1 comment
Labels
question Further information is requested

Comments

@adamaltman
Copy link

Can a reference object ($ref) be used for the update property?

update Any An object with the properties and values to be merged with the object(s) referenced by the target. This property has no impact if remove property is true.

The reason I ask is that people struggle with the OpenAPI format itself. Take overlays and it adds an extra level of complexity. The spec seems silent about it and I'm unclear if Any allows for reference object usage.

I would like to be able to use the overlay like this:

overlay: 1.0.0
info:
  title: Structured Overlay
  version: 1.0.0
actions:
- target: "$"   # Root of document
  update:
    $ref: ./my/changed/openapi.yaml

Why? Because I could use my knowledge of OpenAPI, existing OpenAPI authoring tooling, and not need to learn anything new other than this little snippet I copy and paste into its own separate overlay.yaml file.

@ralfhandl
Copy link
Contributor

@adamaltman The update object in this example is valid.

It would be merged with the target document, resulting in a document that has a $ref field in the root object if the target document represents a single JSON object.

If that target document was a valid OpenAPI description, then the end result is not a valid OpenAPI description, as the OpenAPI Object does not allow $ref.

@ralfhandl ralfhandl added the question Further information is requested label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants