Skip to content

PATCH: Fix bugs in compiled schemas - #609

Open
mrshll1001 wants to merge 12 commits into
3.3.2-devfrom
fix-compiled-schemas
Open

mrshll1001 wants to merge 12 commits into
3.3.2-devfrom
fix-compiled-schemas

Conversation

@mrshll1001

Copy link
Copy Markdown
Contributor

Related issues

Description

This PR enacts the Technical Committee decision to manually refactor the compiled schemas to remove bugs.

This is achieved by updating a number of compiled schema files, replacing the contents with references to appropriate schemas in HSDS.

This means that they are kept up to date with HSDS development, but avoids needing a MAJOR upgrade to change the return schemas in the API Specification.

Merge checklist

  • Update the changelog

If you have edited any schema files:

  • Run hsds_schema.py to update datapackage.json and example files

If you are working towards a new MINOR release:

  • Update any $id values in schema files where appropriate
  • Update the $ref values in openapi.json

Refactored package schemas to directly reference the uncompiled schemas
in the `schema/` directory.

This is to ensure that they keep up to date with changes to these
schemas without much need for manual updates.
Refactored compiled schemas into simple objects containing `$ref` which
points to the uncompiled version.

This was done to remove discrepancies between various compiled schemas
and the uncompiled versions, as documented in various issues and
threads.

See https://forum.openreferral.org/t/compiled-schemas-considered-harmful/839/4

These could be subject to drift if not managed correctly, so replacing
the dereferenced content with `$ref` ensures that any updates made to
uncompiled schemas are simply carried through.

This approach fixes the bugs, but keeps the URLs declared in the
openapi.json file intact to avoid a MAJOR upgrade.
Refactored package schemas to directly reference the uncompiled schemas
in the `schema/` directory.

This is to ensure that they keep up to date with changes to these
schemas without much need for manual updates.
Refactored compiled schemas into simple objects containing `$ref` which
points to the uncompiled version.

This was done to remove discrepancies between various compiled schemas
and the uncompiled versions, as documented in various issues and
threads.

See https://forum.openreferral.org/t/compiled-schemas-considered-harmful/839/4

These could be subject to drift if not managed correctly, so replacing
the dereferenced content with `$ref` ensures that any updates made to
uncompiled schemas are simply carried through.

This approach fixes the bugs, but keeps the URLs declared in the
openapi.json file intact to avoid a MAJOR upgrade.
Updated schema links to point to upcoming 3.3.2
Updated the URLs of schemas in openapi.json to point to upcoming 3.3.2
Ran hsds_schema docs-all to regenerate openapi30.json for the docs
Update validate examples test to reflect the new status of the compiled
schemas
This commit adds the field `organization.services` to match the
behaviour enacted by the HSDS Schema tools.

This brings the organization schema in line with prior expectations set
by the HSDS Schema tool's compilation step (i.e. adding in the
organization.services property).
Refactored the test_examples_jsonschema workflow to directly use the
`check-jsonschema` command added by the runner, rather than relying on
the `validate_examples_json_schema.sh` script in the root directory.

The script was failing because of the circular reference between
organization and service schemas with `compiletojsonschema` reaching the
limit of Python nesting.

The `check-jsonschema` tool is more efficient at checking things, and
now the test has been refactored to test each example directly against
the appropriate schema.

Noting here; it's currently not possible to test the "list" examples
(.e.g `examples/organization_list.json`) due to the fact that they are
structured according to the embedded `Page` schema; currently modelled
in the `openapi.json` file. It may be worth extracting that later, to
tidy everything up and keep it maintainable.
Updated Swagger UI to handle rendering of OAS 3.1. This should forgo the
need to recompile/regenerate the `openapi.json` file specifically for
the docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant