GenomicDataInfrastructure / gdi-userportal-dataset-discovery-service

0 stars 1 forks source link

feat: add access_url and download_url to distribution #134

Closed brunopacheco1 closed 1 month ago

brunopacheco1 commented 1 month ago

Summary by Sourcery

Introduce 'accessUrl' and 'downloadUrl' fields to the distribution schema in the OpenAPI specification and update related tests to reflect these changes. Remove unnecessary 'title' attributes from schema components to streamline the specification.

New Features:

Enhancements:

Tests:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This PR updates the distribution model by replacing the single 'uri' field with two new fields: 'accessUrl' and 'downloadUrl'. The changes are implemented across the OpenAPI specifications and their corresponding Java implementations, including necessary updates to the mapping logic and test cases.

Updated class diagram for PackageShowMapper

classDiagram
    class PackageShowMapper {
        +RetrievedDistribution distribution(CkanResource ckanResource)
    }

    class RetrievedDistribution {
        +String title
        +String description
        +ValueLabel format
        +String accessUrl
        +String downloadUrl
        +String createdAt
        +String modifiedAt
    }

    class CkanResource {
        +String name
        +String description
        +String format
        +String accessUrl
        +String downloadUrl
        +String created
        +String lastModified
    }

    PackageShowMapper --> RetrievedDistribution
    RetrievedDistribution --> ValueLabel
    CkanResource --> RetrievedDistribution

File-Level Changes

Change Details Files
Updated OpenAPI specifications to replace 'uri' with 'accessUrl' and 'downloadUrl'
  • Removed 'uri' field from distribution schema
  • Added 'accessUrl' and 'downloadUrl' string fields
  • Added new fields to CKAN API specification
  • Removed redundant 'title' attributes from various schema fields
src/main/openapi/discovery.yaml
src/main/openapi/ckan.yaml
Updated Java implementation to handle new URL fields
  • Modified distribution mapping to use new URL fields instead of uri
  • Updated test cases to reflect the new URL structure
  • Maintained existing date parsing functionality
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/persistence/CkanDatasetsRepository.java
src/main/java/io/github/genomicdatainfrastructure/discovery/utils/PackageShowMapper.java
src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).