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

fix: openapi stuff #6454

Merged
merged 9 commits into from
May 30, 2024
Merged

fix: openapi stuff #6454

merged 9 commits into from
May 30, 2024

Conversation

psychedelicious
Copy link
Collaborator

Summary

Fix some issues with openapi schema generation. See commits for details.

Related Issues / Discussions

https://discord.com/channels/1020123559063990373/1049495067846524939/1245141831394529352

QA Instructions

App should work, workflows should work.

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@github-actions github-actions bot added python PRs that change python files Root invocations PRs that change invocations services PRs that change app services frontend PRs that change frontend files python-deps PRs that change python dependencies labels May 29, 2024
@psychedelicious
Copy link
Collaborator Author

Note: the vast majority of the diff is regenerated types.

@github-actions github-actions bot added the python-tests PRs that change python tests label May 29, 2024
Some tech debt related to dynamic pydantic schemas for invocations became problematic. Including the invocations and results in the event schemas was breaking pydantic's handling of ref schemas. I don't really understand why - I think it's a pydantic bug in a remote edge case that we are hitting.

After many failed attempts I landed on this implementation, which is actually much tidier than what was in there before.

- Create pydantic-enabled types for `AnyInvocation` and `AnyInvocationOutput` and use these in place of the janky dynamic unions. Actually, they are kinda the same, but better encapsulated. Use these in `Graph`, `GraphExecutionState`, `InvocationEventBase` and `InvocationCompleteEvent`.
- Revise the custom openapi function to work with the new models.
- Split out the custom openapi function to a separate file. Add a `post_transform` callback so consumers can customize the output schema.
- Update makefile scripts.
Reduces the constant changes to the frontend client types due to inconsistent ordering of pydantic models.
Keep track of whether or not the typeadapter needs to be updated. Allows for dynamic invocation and output unions.
This fixes the tests and slightly changes output types.
@blessedcoolant blessedcoolant merged commit cfb1261 into main May 30, 2024
14 checks passed
@blessedcoolant blessedcoolant deleted the psyche/fix/openapi-nonsense branch May 30, 2024 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-deps PRs that change python dependencies python-tests PRs that change python tests Root services PRs that change app services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants