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

Enums cause Breaking Changes for non-breaking Feature Extensions #220

Closed
1 task done
sebbader-sap opened this issue Jan 24, 2024 · 0 comments · Fixed by #375
Closed
1 task done

Enums cause Breaking Changes for non-breaking Feature Extensions #220

sebbader-sap opened this issue Jan 24, 2024 · 0 comments · Fixed by #375
Labels
Milestone

Comments

@sebbader-sap
Copy link
Contributor

sebbader-sap commented Jan 24, 2024

What?

Using Enums for attribute values which shall be open for custom extensions, or later minor releases of the AAS specs, cause errors in older implementations.
Example: https://app.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/schemas/ServiceDescription contains an enum for profiles, which means that the value space is closed. If a company/ecosystem wants to add an own profile (at their own risk that it will not be an official IDTA-backed profile), a client implementation can not parse this.

The example below violates the OpenAPI declaration:

{ 
  "profiles": [ 
      "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-002",
      "https://example.com/aas/my-custom-registry-profile"
   ]
}

How?

Do not use enums wherever we are not 100% sure that the value items are all known. Use a less restrictive (ergo: extendable) type when this is not the case.

Current structure:

    ServiceDescription: 
      properties: 
        profiles:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellServiceSpecification/SSP-001"
              - "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellServiceSpecification/SSP-002"
              - "https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-001"

Possible approach (haven't tested it yet):

    ServiceDescription: 
      properties: 
        profiles:
          type: array
          minItems: 1
          items:
            type: string
            anyOf:
              - const: "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellServiceSpecification/SSP-001"
              - const: "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellServiceSpecification/SSP-002"
              - const: "https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-001"
              -  {}

Source: OAI/OpenAPI-Specification#1552 (comment)

  • I have signed the required Developer Certificate of Origin (DCO) already.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants