Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to a supported OpenAPI validator. #430

Merged
merged 3 commits into from
Jul 11, 2024
Merged

Commits on Jul 10, 2024

  1. PB-687: fix no-$ref-siblings lint errors.

    When updating the linter to something more recent, supported and more strict,
    we uncovered the following errors:
    
    ```
    Message :   $ref must not be placed next to any other properties
    Rule    :   no-$ref-siblings
    Path    :   components.schemas.itemBase.properties.properties.readOnly
    Line    :   1097
    
    Message :   $ref must not be placed next to any other properties
    Rule    :   no-$ref-siblings
    Path    :   components.schemas.itemBase.properties.stac_version.readOnly
    Line    :   1100
    ```
    
    The no-$ref-siblings rule is documented in https://docs.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules#no-ref-siblings
    We resolve this by moving the `readOnly` attribute into the component. This was
    already done for `stac_version`. For `properties` we verified it is only used
    in one place so it should be safe.
    adk-swisstopo committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    613f084 View commit details
    Browse the repository at this point in the history
  2. PB-687: fix ibm-schema-type-format lint error.

    When updating the linter to something more recent, supported and stricter,
    we uncovered the following error:
    
    ```
    Message :   Schema of type string should use one of the following formats: binary, byte, crn, date, date-time, email, identifier, password, url, uuid
    Rule    :   ibm-schema-type-format
    Path    :   components.schemas.sha256
    Line    :   665
    ```
    
    The ibm-schema-type-format rule is documented in https://github.com/IBM/openapi-validator/blob/main/docs/ibm-cloud-rules.md#ibm-schema-type-format
    We resolve this by changing the format from `digest` to `binary`. Additionnally,
    we set `minLength` and `maxLength` to 64 as that's the lenght of a SHA-256 hash
    expressed as hexadecimal.
    adk-swisstopo committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    48dd44c View commit details
    Browse the repository at this point in the history
  3. PB-687: switch to a supported OpenAPI validator.

    We currently use IBM's OpenAPI validator 0.54.0 (released circa February 2022)
    from an old unsupported Docker image. With this change we update to version
    1.19.2 (released June 2024) based on a Docker image shipped by IBM itself.
    
    There were many changes in the validator since. In particular, the ruleset has
    stricter checks about naming conventions that are specific to IBM guidelines
    and which we don't follow. Rather than updating our specs to comply with IBM
    guidelines, we disable these specific checks.
    
    We also remove the old .validaterc configuration file which the newer validator
    is not able to parse anyway.
    adk-swisstopo committed Jul 10, 2024
    Configuration menu
    Copy the full SHA
    1254bb7 View commit details
    Browse the repository at this point in the history