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

Introduce bal openapi flatten sub command #1769

Merged
merged 13 commits into from
Sep 12, 2024
Merged

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Sep 10, 2024

Purpose

$Subject

Part of: ballerina-platform/ballerina-library#6977

Description

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
       Make the OpenAPI contract more readable by relocating all inline
       embedded schemas to the components section and assigning each a
       unique, Ballerina-friendly name.

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 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 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

@TharmiganK TharmiganK marked this pull request as ready for review September 10, 2024 07:48
Copy link

sonarcloud bot commented Sep 11, 2024

@TharmiganK TharmiganK merged commit 742e11e into master Sep 12, 2024
4 checks passed
@TharmiganK TharmiganK deleted the flatten-sub-command branch September 12, 2024 05:12
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