Skip to content

Commit

Permalink
feat(o2k): add inso-compatible flag
Browse files Browse the repository at this point in the history
This will generate a deck config without ids, and the generated
names will be the same as Inso.
  • Loading branch information
Tieske committed Oct 27, 2023
1 parent 72dccbc commit 0e06cbe
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmd/file_openapi2kong.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var (
cmdO2KdocName string
cmdO2KoutputFormat string
cmdO2KentityTags []string
cmdO2KskipID bool
cmdO2KinsoCompat bool
)

// Executes the CLI command "openapi2kong"
Expand All @@ -32,9 +34,14 @@ func executeOpenapi2Kong(cmd *cobra.Command, _ []string) error {

cmdO2KoutputFormat = strings.ToUpper(cmdO2KoutputFormat)

if cmdO2KinsoCompat {
cmdO2KskipID = true // this is implicit in inso compatibility mode
}
options := openapi2kong.O2kOptions{
Tags: cmdO2KentityTags,
DocName: cmdO2KdocName,
Tags: cmdO2KentityTags,
DocName: cmdO2KdocName,
SkipID: cmdO2KskipID,
InsoCompat: cmdO2KinsoCompat,
}

trackInfo := deckformat.HistoryNewEntry("openapi2kong")
Expand Down Expand Up @@ -90,6 +97,12 @@ The output will be targeted at Kong version 3.x.
openapi2kongCmd.Flags().StringSliceVar(&cmdO2KentityTags, "select-tag", nil,
"Select tags to apply to all entities. If omitted, uses the \"x-kong-tags\"\n"+
"directive from the file.")
openapi2kongCmd.Flags().BoolVar(&cmdO2KskipID, "no-id", false,
"Setting this flag will skip UUID generation for entities (no 'id' fields\n"+
"will be added, implicit if '--inso-compatible' is set).")
openapi2kongCmd.Flags().BoolVarP(&cmdO2KinsoCompat, "inso-compatible", "i", false,
"This flag will enable Inso compatibility. The generated entity names will be\n"+
"the same, and no 'id' fields will be gnerated.")

return openapi2kongCmd
}

0 comments on commit 0e06cbe

Please sign in to comment.