-
Notifications
You must be signed in to change notification settings - Fork 64
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
Introduce OpenAPI sanitize and flatten sub commands #6977
Comments
The following is the outline of the NAME
bal openapi flatten - Flatten the OpenAPI contract file
SYNOPSIS
bal openapi flatten [-i | --input] <openapi-contract-file-path>
[-o | --output] <output-file-path>
[-n | --name] <generated-file-name>
[-f | --format] [json|yaml]
[-t | --tags] <tag-names>
[--operations] <operation-names>
DESCRIPTION
Flatten the OpenAPI contract file by moving all the inline schemas to the
components section. The generated schema names will be Ballerina friendly.
OPTIONS
-i, --input <openapi-contract-file-path>
This is a mandatory input. The given OpenAPI contract will be flatten.
The OpenAPI contract can be either a YAML or a JSON.
-o, --output <output-file-path>
This is an optional input. The given output file path will be used to
save the flatten OpenAPI contract. The default output file path is the
executed directory.
-n, --name <generated-file-name>
This is an optional input. The given name will be used to save the
flatten OpenAPI contract. The default name is `flattened_openapi`.
-f, --format [json|yaml]
This is an optional input. The flatten OpenAPI contract will be saved
in given format. The format can be either JSON or YAML.
The default format is same as the input format.
-t, --tags <tag-names>
This is an optional input. The flatten OpenAPI contract will only have
the operations with the given tags.
--operations <operation-names>
This is an optional input. The flatten OpenAPI contract will only have
the given operations.
EXAMPLES
Flatten the `service.yaml` OpenAPI contract file.
$ bal openapi flatten -i service.yaml
Flatten the `service.yaml` OpenAPI contract file and save it as
`flatten_service.json` file.
$ bal openapi flatten -i hello.yaml -n flatten_service -f json
Flatten the `service.json` OpenAPI contract file by filtering the
operations with the `service` tag.
$ bal openapi flatten -i service.json -t service @lnash94 @daneshk @shafreenAnfar Appreciate your inputs on these options |
The following is the outline of the NAME
bal openapi sanitize - Sanitize the OpenAPI contract file according to
the best practices of Ballerina.
SYNOPSIS
bal openapi sanitize [-i | --input] <openapi-contract-file-path>
[-o | --output] <output-file-path>
[-n | --name] <generated-file-name>
[-f | --format] [json|yaml]
[-t | --tags] <tag-names>
[--operations] <operation-names>
DESCRIPTION
Sanitize the OpenAPI contract file according to the best practices of
Ballerina. The OpenAPI contract is flatten and the type schema names
are made Ballerina friendly. The Ballerina name extensions are added
to the schemas which can not be modified.
OPTIONS
-i, --input <openapi-contract-file-path>
This is a mandatory input. The given OpenAPI contract will be sanitized.
The OpenAPI contract can be either a YAML or a JSON.
-o, --output <output-file-path>
This is an optional input. The given output file path will be used to
save the sanitized OpenAPI contract. The default output file path is
the executed directory.
-n, --name <generated-file-name>
This is an optional input. The given name will be used to save the
sanitized OpenAPI contract. The default name is `sanitized_openapi`.
-f, --format [json|yaml]
This is an optional input. The sanitized OpenAPI contract will be
saved in the given format. The format can be either JSON or YAML.
The default format is same as the input file format.
-t, --tags <tag-names>
This is an optional input. The sanitized OpenAPI contract will only
have the operations with the given tags.
--operations <operation-names>
This is an optional input. The sanitized OpenAPI contract will only
have the given operations.
EXAMPLES
Sanitize the `service.yaml` OpenAPI contract file.
$ bal openapi sanitize -i service.yaml
Sanitize the `service.yaml` OpenAPI contract file and save it as
`sanitized_svc.json` file.
$ bal openapi sanitize -i hello.yaml -n sanitized_svc -f json
Sanitize the `service.json` OpenAPI contract file by filtering the
operations with the `service` tag.
$ bal openapi sanitize -i service.json -t service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
Describe your task(s)
bal openapi sanitize
sub commandbal openapi flatten
sub commandRelated Issues (optional):
Part of [Proposal] Convert the OAS to Ballerina-friendly naming conventions
The text was updated successfully, but these errors were encountered: