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

✨ Adding ability to output spec data #516

Merged

Conversation

shawn-hurley
Copy link
Contributor

@shawn-hurley shawn-hurley commented Feb 22, 2024

Adding the ability for the spec of the given components to be rendered in swagger open API.

TODO:

  • Add ability to generate condition and output capabilities on server startup
  • Add the rest of the condition fields for the shared condition (From, As, ignore, not, etc).
  • Validate that the output generally works against a rule-example.yaml file for specifically builtin.filecontent
  • Update providers to all correctly generate the openapi
  • Need to figure out the "output" and how to display that correctly.

@@ -242,3 +265,121 @@ func validateFlags() error {

return nil
}

func createOpenAPISchema(providers map[string]provider.InternalProviderClient, log logr.Logger) openapi3.Spec {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is awesome

@shawn-hurley shawn-hurley force-pushed the feature/add-openapi-output branch from ef228b9 to cf80511 Compare March 5, 2024 16:19
@shawn-hurley shawn-hurley changed the title adding ability to output spec data ✨ Adding ability to output spec data Mar 5, 2024
Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: Shawn Hurley <shawn@hurley.page>
@shawn-hurley shawn-hurley force-pushed the feature/add-openapi-output branch from cf80511 to e43e012 Compare March 5, 2024 16:21
Signed-off-by: Shawn Hurley <shawn@hurley.page>
@shawn-hurley shawn-hurley force-pushed the feature/add-openapi-output branch from 6dcfc9e to ea7ad8c Compare March 6, 2024 15:31
@shawn-hurley
Copy link
Contributor Author

Given the nature of the swagger UI, we would need to define a rest API like a contract. For our purpose, this is probably not what we want right now, skipping the display.

Copy link
Contributor Author

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

Things that I need to fix

lsp/base_service_client/base_service_client.go Outdated Show resolved Hide resolved
parser/open_api.go Outdated Show resolved Hide resolved
parser/open_api.go Outdated Show resolved Hide resolved
provider/internal/builtin/provider.go Outdated Show resolved Hide resolved
@@ -134,9 +134,7 @@ func (p *javaServiceClient) GetDependenciesFallback(ctx context.Context, locatio
p.log.V(10).Info("Analyzing POM",
"POM", fmt.Sprintf("%s:%s:%s", pomCoordinate(pom.GroupID), pomCoordinate(pom.ArtifactID), pomCoordinate(pom.Version)),
"error", err)
if err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to reviewer: this is because this err is checked above this is a redundant call

@@ -672,7 +686,7 @@ func getVersion(depVersion string) (*version.Version, error) {
return v, nil
}
// Parsing failed so we'll try to extract a version and parse that
re := regexp.MustCompile("v?([0-9]+(?:\\.[0-9]+)*)")
re := regexp.MustCompile(`v?([0-9]+(?:.[0-9]+)*)`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note to reviewer, this is something that vs code told me was a warning

Signed-off-by: Shawn Hurley <shawn@hurley.page>
@shawn-hurley shawn-hurley force-pushed the feature/add-openapi-output branch from e2c255b to 802ce3f Compare March 6, 2024 17:20
@shawn-hurley shawn-hurley marked this pull request as ready for review March 6, 2024 17:21
Copy link
Contributor

@pranavgaikwad pranavgaikwad left a comment

Choose a reason for hiding this comment

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

This is great, thank you

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.

2 participants