Skip to content

Commit

Permalink
feat: nested resources, yaml output, deduped collection names (#37)
Browse files Browse the repository at this point in the history
The AEPs allow deduplicating collection names (for example, 
removing the "book" from "book-editions" in the path). Since
this is a fairly common practice, make it something that aepc
will do for you by default.

Also fixing a few places where multiple nested children was not working,
as well as additional issues that came from a hyphen in the resource singular.

Also started building out an internal/ package - eventually most packages
will move there, as aepc is a first and foremost a command-line interface
and intended to be used as a binary.

A utils library was added to do basic casing, as it is common to 
do so.

Adding yaml support for OAS - this faciliates the aepc
examples usage in the aep.dev site.

Adding some missing parameters in the list API for 
OAS.
  • Loading branch information
toumorokoshi authored Oct 25, 2024
1 parent 691707b commit c02b926
Show file tree
Hide file tree
Showing 18 changed files with 2,702 additions and 561 deletions.
12 changes: 11 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func ProcessInput(inputFile, outputFilePrefix string) error {
return fmt.Errorf("error parsing service: %w", err)
}
proto, err := proto.WriteServiceToProto(ps, outputDir)
if(err != nil) {
if err != nil {
return fmt.Errorf("error writing service proto %w", err)
}
protoFile := fmt.Sprintf("%s.proto", outputFilePrefix)
Expand All @@ -93,6 +93,16 @@ func ProcessInput(inputFile, outputFilePrefix string) error {
return fmt.Errorf("error writing file: %w", err)
}
fmt.Printf("output openapi file: %s\n", openapiFile)
yamlOpenAPI, err := yaml.JSONToYAML(openapi)
if err != nil {
return fmt.Errorf("error converting openapi json to yaml: %w", err)
}
yamlOpenAPIFile := fmt.Sprintf("%s_openapi.yaml", outputFilePrefix)
err = WriteFile(yamlOpenAPIFile, yamlOpenAPI)
if err != nil {
return fmt.Errorf("error writing yaml file: %w", err)
}
fmt.Printf("output openapi yaml file: %s\n", yamlOpenAPIFile)
return nil
}

Expand Down
Loading

0 comments on commit c02b926

Please sign in to comment.