Closed shijinrajbosch closed 1 year ago
Please find the actual.json and expected.json enclosed.
Hi @shijinrajbosch, the summary of the relevant parts of the issue is as follows:
An OpenAPI specification document generated for an Aspect Model with esmf-sdk 2.1.3 differs from the one generated for the same model with esmf-sdk 2.3.2. In particular, identifiers that refer to
samm-c
Characteristics make use of SAMM version 2.1.0 instead of 2.0.0. For example,samm-c:Boolean
will lead to the schema identifierurn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean
instead of the expectedurn_samm_org.eclipse.esmf.samm_characteristic_2.0.0_Boolean
.
The APIs that generate documents and artifacts such as OpenAPI specifications documents always work with Aspect Models based on the latest meta model version that is supported by esmf-sdk. In case an Aspect Model is based on a previous meta model version, the model is migrated on-the-fly to the latest meta model version. Therefore artifacts such as OpenAPI specification documents can also be generated for Aspect Models based on older meta model versions. The result is expected and works as intended: The generated OpenAPI specification document is therefore based on the latest meta model version and is equally valid as the previously generated document. The only difference is that is now based on an Aspect Model that makes used of SAMM 2.1.0. However, as the schema identifiers are only use in the spec but do not appear in the API itself, there is no difference in the API that was generated from the Aspect Model.
I suggest you adjust the tests in your project to not assume textual equality between the documents, because this is not provided. If you programmatically need to access the meta model version that will be used in the artifact generation (for example to assert its presence in the generated document), you can use the org.eclipse.esmf.samm.KnownVersion#getLatest()
method which is provided by the org.eclipse.esmf:esmf-semantic-aspect-meta-model Maven artifact.
I'm closing this issue since the OpenAPI generation works as intended.
Many thanks @atextor for the clarifications, help and support.
Describe the bug Test case works with sds-aspect-model-starter 2.1.3 & esmf-aspect-model-starter 2.2.3 and failing with - esmf-aspect-model-starter 2.3.2
Test class : org.eclipse.tractusx.semantics.hub.ModelsApiTest Test method : testGenerateOpenApiEndpointSpecExpectSuccess()
Semantic-hub Github : https://github.com/bci-oss/sldt-semantic-hub.git Branch - SAMM_BAMM_Support-ESMF_SDK_2.3.2
Where Test class : org.eclipse.tractusx.semantics.hub.ModelsApiTest Test method : testGenerateOpenApiEndpointSpecExpectSuccess()
Testcase Assertion Expected: #/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.0.0_Boolean got: #/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean ; components.schemas Testcase Assertion Expected: urn_samm_org.eclipse.esmf.samm_characteristic_2.0.0_Boolean but none found
Additional context Steps to reproduce the issue :
String urnPrefix = "urn:samm:org.eclipse.tractusx.testopenapi:1.0.0#"; String baseUrl = "example.com";
Get a Model - find model from fuseki data base using the org.eclipse.esmf.aspectmodel.urn.AspectModelUrn . The model created in apache fuseki database is here
String modelDefinition = model.toString()