prefect icon indicating copy to clipboard operation
prefect copied to clipboard

[DO NOT MERGE] Test schema diff action

Open zangell44 opened this issue 2 years ago • 1 comments

Summary

An ongoing source of issues for internal Prefect teams has been keeping up to date with changes in the Orion API.

This PR introduces

  • Automatic detection of breaking API changes in the Orion API.
  • Automatic summary of changes to Orion API routes and schemas for relevant PRs. (GitHub Actions will upsert the PR comment).

Initially I tried using oasdiff for both purposes. However, change summary output by oasdiff wasn't adequate. I've created a utility for generating this report instead. oasdiff is still being used to detect breaking changes for now, we'll monitor it going forward.

Steps Taken to QA Changes

https://github.com/PrefectHQ/prefect/actions/workflows/check-for-schema-updates.yaml

Remaining TODOs

  • [ ] Identify changes to nested schemas that impact parent schemas and api routes
  • [ ] Clean up example schema changes before merging
  • [ ] In a subsequent PR, implement proper comparison by checking out the prior version

Happy engineering!

zangell44 avatar Aug 02 '22 20:08 zangell44

Orion API schema changes in this PR:

Added Schemas

NewSchema Description: New schema for testing Type: object Properties: {'x': {'default': 1, 'description': 'A field for testing', 'title': 'X', 'type': 'integer'}}

Deleted Schemas

No schemas deleted.

Schema updates

Flow The following changes have been made:

    "$update": {
        "properties": {
            "$insert": {
                "new_field": {
                    "default": "theres a default so not breaking",
                    "description": "this is a field i added as a test",
                    "title": "New Field",
                    "type": "string"
                }
            }
        }
    }
}

Added routes

The following routes have been added: POST - /api/flows/new_route_example/{path_param} Description: A new route for tesing this PR Parameters: Name: path_param Location: path Required?: True Type: integer

Name: x-prefect-api-version Location: header Required?: False Type: string

Name: (request body) Location: Body Requred?: True Type: {'$ref': '#/components/schemas/NewSchema'}

Deleted Routes

No routes deleted

Route changes

POST - /api/flows/ The following changes have been made:

{
    "$update": {
        "parameters": {
            "$insert": [
                [
                    0,
                    {
                        "in": "header",
                        "name": "new-param",
                        "required": true,
                        "schema": {
                            "title": "New-Param",
                            "type": "integer"
                        }
                    }
                ]
            ]
        }
    }
}

github-actions[bot] avatar Aug 03 '22 13:08 github-actions[bot]

This is really cool! Feel free to re-open :)

zanieb avatar Dec 30 '22 16:12 zanieb