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

Refactor st2-generate-schemas to be importable #5708

Merged
merged 4 commits into from
Aug 19, 2022
Merged

Conversation

cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Aug 12, 2022

Background

I'm working towards introducing pants. One of the first things we will use it for is linting / reformatting (it will run black, flake8, etc). Schema generation should happen more regularly, so we'll hook that up so pants runs it when it runs fmt and other tools.

When pants runs these tools, however, it (or rather PEX, which pants uses), it needs to import the python code. Our script, however, is a kebab-case-file, so python cannot import from it. (Eventually, this will not be a requirement. PEX has been updated to handle this, so pants just needs to have the new option plumbed in before we can use it. For now, though, pants can only run importable python files.)

Overview

Currently schema generation is often missed, so the schemas often get out of date. We have some CI to catch this, but it doesn't error in every case, so there's one API schema that actually needs to be regenerated.

So, this PR does the following:

  • refactor st2-generate-schemas so that logic is in an importable module
  • run st2-generate-schemas to regenerate that outdated API schema

@cognifloyd cognifloyd added this to the 3.8.0 milestone Aug 12, 2022
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Aug 12, 2022
@cognifloyd cognifloyd self-assigned this Aug 12, 2022
@cognifloyd cognifloyd requested review from nzlosh, rush-skills and a team August 12, 2022 19:41
@cognifloyd cognifloyd changed the title Refactor API schema generation/validation to be importable Refactor schema generation to be importable Aug 12, 2022
@cognifloyd cognifloyd changed the title Refactor schema generation to be importable Refactor st2-generate-schemas to be importable Aug 12, 2022
@cognifloyd cognifloyd requested a review from a team August 15, 2022 15:28
@cognifloyd cognifloyd enabled auto-merge August 18, 2022 01:45
Copy link
Contributor

@nzlosh nzlosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cognifloyd cognifloyd merged commit 7638512 into master Aug 19, 2022
@cognifloyd cognifloyd deleted the schema-gen branch August 19, 2022 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintenance pantsbuild refactor size/L PR that changes 100-499 lines. Requires some effort to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants