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

feat: generate schema from RestApi construct #235

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

joshkraft
Copy link
Contributor

Fixes #220

Adds PolicyStore.schemaFromRestApi(), a method for generating AVP permissions schemas directly from the RestApi construct. This alternative allows for easier schema synchronization/generation when API changes occur, complementing the existing PolicyStore.schemaFromOpenApiSpec() that requires a Swagger JSON file.

Copy link
Contributor

@reste85 reste85 left a comment

Choose a reason for hiding this comment

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

One fix to do, then we're good to go.

Thanks a lot for the contribution! :)

return buildSchema(namespace, actionNames, groupEntityTypeName);
}

private static RELEVANT_HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'head'];
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not keep it as static, a const should be fine. So we avoid problems with this accessibility.
See similar example: Playground Link

Copy link
Contributor Author

@joshkraft joshkraft Sep 5, 2024

Choose a reason for hiding this comment

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

Just refactored this. Let me know if you had something different in mind. Thanks for the speedy review!

auto-merge was automatically disabled September 5, 2024 13:55

Head branch was pushed to by a user without write access

Copy link
Contributor

@reste85 reste85 left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks again!

@reste85 reste85 added this pull request to the merge queue Sep 9, 2024
Merged via the queue into cdklabs:main with commit 2883173 Sep 9, 2024
9 checks passed
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.

proposal: schemaFromRestApi Method
2 participants