Skip to content

Commit

Permalink
feat(irs-api): fix OpenAPI examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-jhartmann committed Jun 6, 2024
1 parent 56397b7 commit 549b16d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
36 changes: 17 additions & 19 deletions docs/src/api/irs-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,14 @@ components:
models:
- name: SingleLevelBomAsBuilt
status: RELEASED
type: BAMM
type: SAMM
urn: urn:samm:io.catenax.single_level_bom_as_built:3.0.0#SingleLevelBomAsBuilt
version: 2.0.0
version: 3.0.0
- name: SerialPart
status: RELEASED
type: BAMM
type: SAMM
urn: urn:samm:io.catenax.serial_part:3.0.0#SerialPart
version: 1.0.1
version: 3.0.0
canceled-job-response:
value:
completedOn: 2022-02-03T14:48:54.709Z
Expand Down Expand Up @@ -1218,7 +1218,7 @@ components:
semanticId:
keys:
- type: ExternalReference
value: urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned
value: urn:samm:io.catenax.single_level_bom_as_built:3.0.0#SingleLevelBomAsBuilt
type: ModelReference
- description:
- language: en
Expand Down Expand Up @@ -1341,7 +1341,7 @@ components:
semanticId:
keys:
- type: ExternalReference
value: urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned
value: urn:samm:io.catenax.single_level_bom_as_built:3.0.0#SingleLevelBomAsBuilt
type: ModelReference
- description:
- language: en
Expand Down Expand Up @@ -1370,15 +1370,14 @@ components:
payload:
catenaXId: urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447
childItems:
- catenaXId: urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447
- businessPartner: BPNL00012345aNXY
catenaXId: urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447
createdOn: 2022-02-03T14:48:54.709Z
hasAlternatives: false
lastModifiedOn: 2022-02-03T14:48:54.709Z
lifecycleContext: AsBuilt
quantity:
measurementUnit:
datatypeURI: urn:bamm:io.openmanufacturing:meta-model:1.0.0#piece
lexicalValue: piece
quantityNumber: 1
unit: unit:piece
value: 20.0
tombstones:
- catenaXId: urn:uuid:6c311d29-5753-46d4-b32c-19b918ea93b0
endpointURL: https://catena-x.net/vehicle/partdetails/
Expand Down Expand Up @@ -1539,7 +1538,7 @@ components:
semanticId:
keys:
- type: ExternalReference
value: urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned
value: urn:samm:io.catenax.single_level_bom_as_built:3.0.0#SingleLevelBomAsBuilt
type: ModelReference
- description:
- language: en
Expand Down Expand Up @@ -1568,15 +1567,14 @@ components:
payload:
catenaXId: urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447
childItems:
- catenaXId: urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447
- businessPartner: BPNL00012345aNXY
catenaXId: urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447
createdOn: 2022-02-03T14:48:54.709Z
hasAlternatives: false
lastModifiedOn: 2022-02-03T14:48:54.709Z
lifecycleContext: AsBuilt
quantity:
measurementUnit:
datatypeURI: urn:bamm:io.openmanufacturing:meta-model:1.0.0#piece
lexicalValue: piece
quantityNumber: 1
unit: unit:piece
value: 20.0
tombstones:
- catenaXId: urn:uuid:6c311d29-5753-46d4-b32c-19b918ea93b0
endpointURL: https://catena-x.net/vehicle/partdetails/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ private Example createAspectModelsResult() {
final AspectModel assemblyPartRelationship = AspectModel.builder()
.name("SingleLevelBomAsBuilt")
.urn(SINGLE_LEVEL_BOM_AS_BUILT_ASPECT)
.version("2.0.0")
.version("3.0.0")
.status("RELEASED")
.type("BAMM")
.type("SAMM")
.build();
final AspectModel serialPart = AspectModel.builder()
.name("SerialPart")
.urn(SERIAL_PART_ASPECT)
.version("1.0.1")
.version("3.0.0")
.status("RELEASED")
.type("BAMM")
.type("SAMM")
.build();

return toExample(AspectModels.builder()
Expand Down Expand Up @@ -359,12 +359,24 @@ private Submodel createSubmodel() {
}

private Map<String, Object> createSingleLevelBomAsBuiltPayloadMap() {
final String singleLevelBomAsBuiltPayload =
"{\"catenaXId\": \"urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447\", "
+ "\"childItems\": [ { \"createdOn\": \"2022-02-03T14:48:54.709Z\", \"catenaXId\": \"urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447\", "
+ "\"lastModifiedOn\": \"2022-02-03T14:48:54.709Z\", \"lifecycleContext\": \"AsBuilt\", \"quantity\": "
+ "{\"measurementUnit\": {\"datatypeURI\": \"urn:bamm:io.openmanufacturing:meta-model:1.0.0#piece\",\"lexicalValue\": \"piece\"},\"quantityNumber\": 1}}]}";

final String singleLevelBomAsBuiltPayload = """
{
"catenaXId": "urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447",
"childItems": [
{
"catenaXId": "urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447",
"quantity": {
"value": 20.0,
"unit": "unit:piece"
},
"hasAlternatives": false,
"createdOn": "2022-02-03T14:48:54.709Z",
"businessPartner": "BPNL00012345aNXY",
"lastModifiedOn": "2022-02-03T14:48:54.709Z"
}
]
}
""";
return new JsonUtil().fromString(singleLevelBomAsBuiltPayload, Map.class);
}

Expand Down Expand Up @@ -441,7 +453,7 @@ private SubmodelDescriptor createBaseSubmodelDescriptor() {
.semanticId(Reference.builder()
.keys(List.of(SemanticId.builder()
.type("ExternalReference")
.value("urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned")
.value(SINGLE_LEVEL_BOM_AS_BUILT_ASPECT)
.build()))
.type("ModelReference")
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
})
class SemanticsHubClientLocalStub implements SemanticsHubClient {

public static final String MODEL_TYPE = "BAMM";
public static final String MODEL_TYPE = "SAMM";
public static final String MODEL_STATUS = "RELEASED";

@Override
Expand Down

0 comments on commit 549b16d

Please sign in to comment.