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

Use of anyOf for datastoreId in components/schemas/instanceCreateVolume.yaml #72

Open
matthew-c-hpe opened this issue Aug 30, 2024 · 0 comments

Comments

@matthew-c-hpe
Copy link

While trying to work with your OpenAPI documentation, I have encountered the use following use of anyOf in components/schemas/instanceCreateVolume.yaml:
https://github.com/gomorpheus/morpheus-openapi/blob/main/components/schemas/instanceCreateVolume.yaml

  datastoreId:
    anyOf:
      - type: string
        nullable: true
      - type: integer
        format: int64
        nullable: true
    description: The ID of the specific datastore. Auto selection can be specified as auto or autoCluster (for clusters).

I am wondering if the use of anyOf here was intentional.
Given that the property relates to an ID of some kind, it seems more appropriate that the oneOf schema type should be used.

Suggested change:

  datastoreId:
    oneOf:

If the use of anyOf was intentional, for my understanding, would you please be able to explain why anyOf was selected as the appropriate schema type?

Given the following variations that the anyOf schema type would allow with the nullable string and integer types used, I am confused as to why, in particular, both a string and an integer would be valid in the request body:

Valid with anyOf:
1. null string
2. string
3. null int
4. int
5. null int + null string
6. int + null string
7. null int + string
8. int + string

The use of the schema in components/schemas/instanceCreateVolume.yaml appears to come from a PUT request to the /api/catalog-item-types/{id} endpoint:

https://github.com/gomorpheus/morpheus-openapi/blob/main/openapi.yaml#L157
https://github.com/gomorpheus/morpheus-openapi/blob/main/paths/api%40catalog-item-types%40id.yaml#L43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant