Skip to content

Commit

Permalink
Merge pull request #353 from bci-oss/update-version-v3.1.0-to-v3
Browse files Browse the repository at this point in the history
Feat: Changed API Path to V3
  • Loading branch information
tunacicek authored Mar 20, 2024
2 parents b75a266 + b759e21 commit d8a7602
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 92 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.4.1-RC3
## 0.4.1
### Added
- Added API POST lookup/shellsByAssetLink to retrieve shell ids without base64 encryption.
- Added v3.1.0 postman collection for new API.
## fixed
- Changed API path from api/v3.0/ to api/v3/

## 0.4.1-RC2
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ servers:
- "443"
- "4243"
version_prefix:
default: v3.0
default: v3
enum:
- v3.0
- v3
context_root:
description: Context root for the API
default: ""
Expand Down
6 changes: 3 additions & 3 deletions backend/loadtests/locust/locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ class AasRegistryTask(HttpUser):
def createAndQueryAasDescriptor(self):
shell = generate_shell()
headers = { 'Content-Type' : 'application/json', 'Edc-Bpn' : 'BPN_COMPANY_1'}
with self.client.post("/api/v3.0/shell-descriptors", data=json.dumps(shell), headers= headers, catch_response=True) as response:
with self.client.post("/api/v3/shell-descriptors", data=json.dumps(shell), headers= headers, catch_response=True) as response:
if response.status_code != 201:
response.failure(f"Expected 201 but status code was {response.status_code}")
raise RescheduleTask()

shell_id = shell['id']
shell_id_encoded = str(base64.urlsafe_b64encode(shell_id.encode("utf-8")), "utf-8")

with self.client.get(f"/api/v3.0/shell-descriptors/{shell_id_encoded}", name = "/api/v3.0/shell-descriptors/{id}", headers= headers, catch_response=True) as response:
with self.client.get(f"/api/v3/shell-descriptors/{shell_id_encoded}", name = "/api/v3/shell-descriptors/{id}", headers= headers, catch_response=True) as response:
if response.status_code != 200:
response.failure(f"Expected 200 but status code was {response.status_code}")
raise RescheduleTask()

specificAssetIds = shell['specificAssetIds']
decodedAssetIds = urllib.parse.quote_plus(json.dumps(specificAssetIds))
with self.client.get(f"/api/v3.0/lookup/shells?assetIds={decodedAssetIds}", name = "/api/v3.0/lookup/shells?assetIds={assetIds}", headers= headers, catch_response=True) as response:
with self.client.get(f"/api/v3/lookup/shells?assetIds={decodedAssetIds}", name = "/api/v3/lookup/shells?assetIds={assetIds}", headers= headers, catch_response=True) as response:
if response.status_code != 200:
response.failure(f"Expected 200 but status code was {response.status_code}")
raise RescheduleTask()
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/static/aas-registry-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ servers:
- "443"
- "4243"
version_prefix:
default: v3.0
default: v3
enum:
- v3.0
- v3
context_root:
description: Context root for the API
default: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
@EnableConfigurationProperties( RegistryProperties.class)
public abstract class AbstractAssetAdministrationShellApi {

protected static final String SHELL_BASE_PATH = "/api/v3.0/shell-descriptors";
protected static final String SINGLE_SHELL_BASE_PATH = "/api/v3.0/shell-descriptors/{aasIdentifier}";
protected static final String LOOKUP_SHELL_BASE_PATH = "/api/v3.0/lookup/shells";
protected static final String LOOKUP_SHELL_BASE_PATH_POST = "/api/v3.0/lookup/shellsByAssetLink";
protected static final String SINGLE_LOOKUP_SHELL_BASE_PATH = "/api/v3.0/lookup/shells/{aasIdentifier}";
protected static final String SUB_MODEL_BASE_PATH = "/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors";
protected static final String SINGLE_SUB_MODEL_BASE_PATH = "/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}";
protected static final String SHELL_BASE_PATH = "/api/v3/shell-descriptors";
protected static final String SINGLE_SHELL_BASE_PATH = "/api/v3/shell-descriptors/{aasIdentifier}";
protected static final String LOOKUP_SHELL_BASE_PATH = "/api/v3/lookup/shells";
protected static final String LOOKUP_SHELL_BASE_PATH_POST = "/api/v3/lookup/shellsByAssetLink";
protected static final String SINGLE_LOOKUP_SHELL_BASE_PATH = "/api/v3/lookup/shells/{aasIdentifier}";
protected static final String SUB_MODEL_BASE_PATH = "/api/v3/shell-descriptors/{aasIdentifier}/submodel-descriptors";
protected static final String SINGLE_SUB_MODEL_BASE_PATH = "/api/v3/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}";

protected static final String EXTERNAL_SUBJECT_ID_HEADER = "Edc-Bpn";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ class DescriptionApiTest {
public void testGetDescriptionOnlyDeleteRoleExpectForbidden() throws Exception {
mvc.perform(
MockMvcRequestBuilders
.get( "/api/v3.0/description" )
.get( "/api/v3/description" )
.accept( MediaType.APPLICATION_JSON )
.with( jwtTokenFactory.deleteTwin() )
)
Expand All @@ -1288,7 +1288,7 @@ public void testGetDescriptionOnlyDeleteRoleExpectForbidden() throws Exception {
public void testGetDescriptionNoRoleExpectForbidden() throws Exception {
mvc.perform(
MockMvcRequestBuilders
.get( "/api/v3.0/description" )
.get( "/api/v3/description" )
.accept( MediaType.APPLICATION_JSON )
.with( jwtTokenFactory.withoutRoles() )
)
Expand All @@ -1300,7 +1300,7 @@ public void testGetDescriptionNoRoleExpectForbidden() throws Exception {
public void testGetDescriptionReadRoleExpectSuccess() throws Exception {
mvc.perform(
MockMvcRequestBuilders
.get( "/api/v3.0/description" )
.get( "/api/v3/description" )
.accept( MediaType.APPLICATION_JSON )
.with( jwtTokenFactory.readTwin() )
)
Expand All @@ -1312,7 +1312,7 @@ public void testGetDescriptionReadRoleExpectSuccess() throws Exception {
public void testGetDescriptionReadRoleExpectUnauthorized() throws Exception {
mvc.perform(
MockMvcRequestBuilders
.get( "/api/v3.0/description" )
.get( "/api/v3/description" )
.accept( MediaType.APPLICATION_JSON )
)
.andDo( MockMvcResultHandlers.print() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ class DescriptionApiTest {
public void testGetDescriptionExpectSuccess() throws Exception {
mvc.perform(
MockMvcRequestBuilders
.get( "/api/v3.0/description" )
.get( "/api/v3/description" )
.accept( MediaType.APPLICATION_JSON )
.with( jwtTokenFactory.allRoles() )
)
Expand Down
Loading

0 comments on commit d8a7602

Please sign in to comment.