-
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
Replace Service Description Profiles Enum with an open List #230
Replace Service Description Profiles Enum with an open List #230
Conversation
@danielporta I just tested it by manually translating it to JSON Schema. Summary: "oneOf" is wrong but "anyOf" does the job. |
@sebbader-sap: I don't think this will work. At least, the openapi-spec-validator did not succeed with my MWE. openapi: 3.0.3
info:
title: MWE for anyOf validation
description: a description
contact:
name: Industrial Digital Twin Association (IDTA)
email: info@idtwin.org
license:
name: CC BY 4.0
url: https://creativecommons.org/licenses/by/4.0/
version: V3.0.1_SSP-001
paths:
/description:
get:
tags:
- Description API
summary: Returns the self-describing information of a network resource (ServiceDescription)
operationId: GetDescription
x-semanticIds:
- https://admin-shell.io/aas/API/Descriptor/GetDescription/3/0
responses:
'200':
description: Requested Description
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceDescription'
components:
schemas:
ServiceDescription:
description: The Description object enables servers to present their capabilities to the clients, in particular which profiles they implement. At least one defined profile is required. Additional, proprietary attributes might be included. Nevertheless, the server must not expect that a regular client understands them.
example: >-
{
"profiles": [
"https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-002",
"https://admin-shell.io/aas/API/3/0/SubmodelRegistryServiceSpecification/SSP-002"
]
}
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"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-002"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-003"
- const: "https://admin-shell.io/aas/API/3/0/AasxFileServerServiceSpecification/SSP-001"
- const: "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-001"
- const: "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-002"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelRegistryServiceSpecification/SSP-001"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelRegistryServiceSpecification/SSP-002"
- const: "https://admin-shell.io/aas/API/3/0/DiscoveryServiceSpecification/SSP-001"
- const: "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRepositoryServiceSpecification/SSP-001"
- const: "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRepositoryServiceSpecification/SSP-002"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-001"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-002"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-003"
- const: "https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-004"
- const: "https://admin-shell.io/aas/API/3/0/ConceptDescriptionServiceSpecification/SSP-001"
- {}
type: object
|
Ah @sebbader-sap, I probably copied an old openapi version? 3.0.3 --> 3.1.0 |
Yep, you are right, "const" comes with OpenAPI V3.1.0, e.g.:
This one passes the validation. |
I was also able to change the current state to a valid V3.0.3 version:
anyOf( enum1, enum2, ...) ... I don't know, doesn't look like a good solution to generate code from... |
As discussed in the meeting, we propose to change the OpenAPI definition to the following:
|
@danielporta next attempt: Value of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Daniel checked my comments and answered by questions
4244415
into
IDTA-01002-3-0_bugfix-2-preparation
* fix metadata and path endpoints * increase the version to the v3.0.2 bugfix version * remove bytes * remove "submodelElements" from SubmodelValue * Replace Service Description Profiles Enum with an open List (#230) * change servicedescription/profiles enum to an open list, providing predefined values only as examples * Remove Level from /$metadata (#250) * remove the Level modifier from $metadata requests * remove allOf SubmodelElementAttributes from SubmodelElementMetadata * fix ValueOnly description * PathItem Fix (#262) add array<pathitem> where missing + new pathitem regex * fix the regex pattern for part 2 classes according to the JSON schema regex (#256) * fix bugs in the valueonly classes * change annotations from array to value only * replace regex patterns with latest json schema v3.0.1 content * using the new string regex pattern also for part 2 classes --------- Co-authored-by: Alexander Gordt <100141498+alexgordtop@users.noreply.github.com>
No description provided.