Skip to content

Commit

Permalink
Merge branch 'main' into feat/734-handle-trial-to-modify-readonly-def…
Browse files Browse the repository at this point in the history
…ault-policies
  • Loading branch information
dsmf committed Jul 23, 2024
2 parents 66f74c4 + cfd8475 commit 51bef68
Show file tree
Hide file tree
Showing 15 changed files with 308 additions and 121 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ _**For better traceability add the corresponding GitHub issue number in each cha

## [Unreleased]

### Fixed

- Fixed already merged implementation from _"Access and Usage Policy Validation flow correction. #757"_
where fallback to default policy was not implemented correctly.
- Improved exception handling concerning invalid date format in search parameters for `GET /irs/policies/paged`. #639

### Changed

- Improved documentation for `GET /irs/policies/paged` endpoint. #639
- Cleanup in IrsApplicationTest.generatedOpenApiMatchesContract
(removed obsolete ignoringFields, improved assertion message)

## [5.4.0] - 2024-07-22

### Changed
- Default policies are now configured using JSON in accordance with the ODRL schema. #542
- Improved the exception handling for modification attempts on read-only default policies. Such actions now result in a 400 BAD REQUEST response with a user-friendly error message. #734
Expand Down Expand Up @@ -737,7 +751,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- **Select Aspects you need** You are able to select the needed aspects for which you want to collect the correct endpoint information.


[Unreleased]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.3.0...HEAD
[Unreleased]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.4.0...HEAD
[5.4.0]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.3.0...5.4.0
[5.3.0]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.2.0...5.3.0
[5.2.0]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.1.4...5.2.0
[5.1.4]: https://github.com/eclipse-tractusx/item-relationship-service/compare/5.1.3...5.1.4
Expand Down
20 changes: 19 additions & 1 deletion COMPATIBILITY_MATRIX.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,25 @@ Full changelog of IRS: [changelog](CHANGELOG.md)
| [SingleLevelUsageAsBuilt](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_usage_as_built) | 3.0.0 | - | Model version |
| [SingleLevelUsageAsPlanned](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_usage_as_planned) | 2.0.0 | - | Model version |

## [CATENA-X Release 24.08](https://eclipse-tractusx.github.io/CHANGELOG/) - [5.3.0](https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/5.3.0) - 2024-07-15

## [CATENA-X Release 24.08](https://eclipse-tractusx.github.io/CHANGELOG/) - [5.4.0](https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/5.4.0) - 2024-07-22

| Dependency | Version | Helm | Comments |
|------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|-------|-----------------|
| EDC | 0.7.3 | 0.7.3 | |
| Semantics Hub | 0.3.1 | 0.2.1 | REST connection |
| DTR | 0.5.0 | 0.5.3 | REST connection |
| Discovery Finder | 0.2.5 | - | REST connection |
| Minio | RELEASE.2022-11-11T03-44-20Z | 5.0.1 | |
| Helm | 3.9.3 | - | - |
| Kubernetes | [ 1.28; 1.29; 1.30 ] | - | - |
| [SingleLevelBomAsBuilt](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_bom_as_built) | [ 2.0.0; 3.0.0 ] | - | Model version |
| [SingleLevelBomAsPlanned](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_bom_as_planned) | [ 2.0.0; 3.0.0 ] | - | Model version |
| [SingleLevelBomAsSpecified](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_bom_as_specified) | 2.0.0 | - | Model version |
| [SingleLevelUsageAsBuilt](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_usage_as_built) | 3.0.0 | - | Model version |
| [SingleLevelUsageAsPlanned](https://github.com/eclipse-tractusx/sldt-semantic-models/tree/main/io.catenax.single_level_usage_as_planned) | 2.0.0 | - | Model version |

## [5.3.0](https://github.com/eclipse-tractusx/item-relationship-service/releases/tag/5.3.0) - 2024-07-15

| Dependency | Version | Helm | Comments |
|------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|-------|-----------------|
Expand Down
10 changes: 5 additions & 5 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ maven/mavencentral/org.eclipse.tractusx.edc/core-spi/0.6.0, Apache-2.0, approved
maven/mavencentral/org.eclipse.tractusx.edc/edr-api/0.6.0, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.edc/edr-spi/0.6.0, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-api/0.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-common/2.1.10-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-edc-client/2.1.10-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-models/2.1.10-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-common/2.1.12-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-edc-client/2.1.12-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-models/2.1.12-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-policy-store/0.0.2-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/2.1.10-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-testing/2.1.10-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-registry-client/2.1.12-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.eclipse.tractusx.irs/irs-testing/2.1.12-SNAPSHOT, Apache-2.0, approved, automotive.tractusx
maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp
maven/mavencentral/org.hamcrest/hamcrest-core/2.2, BSD-3-Clause, approved, clearlydefined
maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined
Expand Down
3 changes: 3 additions & 0 deletions charts/item-relationship-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [7.4.0] - 2024-07-22

### Changed

- Update IRS version to 5.4.0
- Changed configuration for default policies (#542) from:
```
edc:
Expand Down
4 changes: 2 additions & 2 deletions charts/item-relationship-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 7.3.1
version: 7.4.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "5.3.0"
appVersion: "5.4.0"
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
Expand Down
33 changes: 18 additions & 15 deletions docs/src/api/irs-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: The API of the Item Relationship Service (IRS) for retrieving item
graphs along the value chain of CATENA-X partners.
title: IRS API
version: 5.3.0
version: 5.4.0
servers:
- url: http://localhost:8080
security:
Expand Down Expand Up @@ -1042,19 +1042,21 @@ paths:
- Policy Store API
/irs/policies/paged:
get:
description: |
Fetch a page of policies with options to filter and sort.
- **Filtering:**
`search=<property>,[EQUALS|STARTS_WITH|BEFORE_LOCAL_DATE|AFTER_LOCAL_DATE],<value>`.
Example: `search=BPN,STARTS_WITH,BPNL12&search=policyId,STARTS_WITH,policy2`.
- **Sorting:**
`sort=<property>,[asc|desc]`.
Example: `sort=BPN,asc&sort=policyId,desc`.
- **Paging:**
Example: `page=1&size=20`
description: "Fetch a page of policies with options to filter and sort.\n \n\
Example:\n```\nsearch=BPN,STARTS_WITH,BPNL12&search=validUntil,AFTER_LOCAL_DATE,2024-12-11&sort=validUntil,asc&sort=BPN,asc\n\
```\n \n### Filtering\n \n`search=<Field>,[EQUALS|STARTS_WITH|BEFORE_LOCAL_DATE|AFTER_LOCAL_DATE],<Value>`.\n\
\ \nExample: `search=BPN,STARTS_WITH,BPNL12&search=policyId,STARTS_WITH,policy2`.\n\
\ \n| Field | Supported Operations | Value Format\
\ |\n|--------------|------------------------------------------|----------------------|\n\
| `BPN` | `EQUALS`, `STARTS_WITH` | any string \
\ |\n| `policyId` | `EQUALS`, `STARTS_WITH` | any\
\ string |\n| `action` | `EQUALS` \
\ | `use` or `access` |\n| `createdOn` | `BEFORE_LOCAL_DATE`, `AFTER_LOCAL_DATE`\
\ | `yyyy-MM-dd` |\n| `validUntil` | `BEFORE_LOCAL_DATE`, `AFTER_LOCAL_DATE`\
\ | `yyyy-MM-dd` |\n\n### Sorting\n`sort=[BPN|policyId|action|createdOn|validUntil],[asc|desc]`.\n\
\ \nExample: `sort=BPN,asc&sort=policyId,desc`. _(default: `BPN,asc`)_\n\n\
### Paging\n \nExample: `page=1&size=20` _(default page size: 10, maximal\
\ page size: 1000)_\n"
operationId: getPoliciesPaged
parameters:
- description: List of business partner numbers. This may also contain the value
Expand Down Expand Up @@ -1096,7 +1098,8 @@ paths:
description: Authorization refused by server.
security:
- api_key: []
summary: Find policies.
summary: "Find registered policies that should be accepted in EDC negotiation\
\ (with filtering, sorting and paging)."
tags:
- Policy Store API
/irs/policies/{policyId}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class IrsApplication {
/**
* The IRS API version.
*/
public static final String API_VERSION = "5.3.0";
public static final String API_VERSION = "5.4.0";

/**
* The URL prefix for IRS API URLs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,14 @@ void generatedOpenApiMatchesContract() throws Exception {
final Map<String, Object> generatedYamlMap = mapper.readerForMapOf(Object.class).readValue(generatedYaml);

try {
// To correctly display both documentations examples - manual and generated by annotations -
// we need to remove verification for some "examples", otherwise one or another won't display correctly
assertThat(generatedYamlMap)

.usingRecursiveComparison()

.ignoringFields("components.schemas.PageResult.example")
.ignoringFields("components.schemas.AspectModels.example")
.ignoringFields("components.schemas.BatchOrderResponse.example")
.ignoringFields("components.schemas.Jobs.example")
.ignoringFields("components.schemas.Policy")
.ignoringFields("components.schemas.BatchResponse.example")

.isEqualTo(definedYamlMap);
} catch (AssertionError e) {
// write changed API to file for easier comparison
Files.writeString(Paths.get("../docs/src/api/irs-api.actual.yaml"), generatedYaml);
throw e;
throw new AssertionError("Please compare the generated irs-api.actual.yaml "
+ "with irs-api.yaml to find the differences easily!", e);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeParseException;

import org.apache.commons.lang3.StringUtils;

/**
* Date utilities.
Expand All @@ -42,10 +45,21 @@ public static boolean isDateAfter(final OffsetDateTime dateTime, final String re
}

public static OffsetDateTime toOffsetDateTimeAtStartOfDay(final String dateString) {
return LocalDate.parse(dateString).atStartOfDay().atOffset(ZoneOffset.UTC);
return parseDate(dateString).atStartOfDay().atOffset(ZoneOffset.UTC);
}

public static OffsetDateTime toOffsetDateTimeAtEndOfDay(final String dateString) {
return LocalDate.parse(dateString).atTime(LocalTime.MAX).atOffset(ZoneOffset.UTC);
return parseDate(dateString).atTime(LocalTime.MAX).atOffset(ZoneOffset.UTC);
}

private static LocalDate parseDate(final String dateString) {
if (StringUtils.isBlank(dateString)) {
throw new IllegalArgumentException("Invalid date format (must not be blank)");
}
try {
return LocalDate.parse(dateString);
} catch (DateTimeParseException e) {
throw new IllegalArgumentException("Invalid date format (please refer to the documentation)", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,38 @@ public List<String> autocomplete(

@GetMapping("/policies/paged")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "Find policies.", //
@Operation(summary = "Find registered policies that should be accepted in EDC negotiation "
+ "(with filtering, sorting and paging).", //
description = """
Fetch a page of policies with options to filter and sort.
\s
Example:
```
search=BPN,STARTS_WITH,BPNL12&search=validUntil,AFTER_LOCAL_DATE,2024-12-11&sort=validUntil,asc&sort=BPN,asc
```
\s
### Filtering
\s
`search=<Field>,[EQUALS|STARTS_WITH|BEFORE_LOCAL_DATE|AFTER_LOCAL_DATE],<Value>`.
\s
Example: `search=BPN,STARTS_WITH,BPNL12&search=policyId,STARTS_WITH,policy2`.
\s
| Field | Supported Operations | Value Format |
|--------------|------------------------------------------|----------------------|
| `BPN` | `EQUALS`, `STARTS_WITH` | any string |
| `policyId` | `EQUALS`, `STARTS_WITH` | any string |
| `action` | `EQUALS` | `use` or `access` |
| `createdOn` | `BEFORE_LOCAL_DATE`, `AFTER_LOCAL_DATE` | `yyyy-MM-dd` |
| `validUntil` | `BEFORE_LOCAL_DATE`, `AFTER_LOCAL_DATE` | `yyyy-MM-dd` |
- **Filtering:**
`search=<property>,[EQUALS|STARTS_WITH|BEFORE_LOCAL_DATE|AFTER_LOCAL_DATE],<value>`.
Example: `search=BPN,STARTS_WITH,BPNL12&search=policyId,STARTS_WITH,policy2`.
### Sorting
`sort=[BPN|policyId|action|createdOn|validUntil],[asc|desc]`.
\s
Example: `sort=BPN,asc&sort=policyId,desc`. _(default: `BPN,asc`)_
- **Sorting:**
`sort=<property>,[asc|desc]`.
Example: `sort=BPN,asc&sort=policyId,desc`.
- **Paging:**
Example: `page=1&size=20`
### Paging
\s
Example: `page=1&size=20` _(default page size: 10, maximal page size: 1000)_
""", //
security = @SecurityRequirement(name = API_KEY), //
tags = { POLICY_API_TAG }, //
Expand Down
Loading

0 comments on commit 51bef68

Please sign in to comment.