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

add --statement-max-depth flag to optional parameters #7641

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/pages/[platform]/reference/cli-commands/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ npx ampx generate outputs --stack amplify-nextamplifygen2-josef-sandbox-ca85e108

## npx ampx generate graphql-client-code

Generate GraphQL statements and types for your frontend application to consume.
Generate GraphQL statements and types for your frontend application to consume.

<SubCommandHeading parentCommand="ampx-generate-graphql-client-code">Options</SubCommandHeading>

The available parameters for `npx ampx generate graphql-client-code` are:

Required parameters:
- Stack identifier
- Stack identifier
- `--stack`(_string_) - A stack name that contains an Amplify backend.
- Project identifier
- `--app-id`(_string_) - The Amplify App ID of the project.
Expand All @@ -252,6 +252,7 @@ Optional parameters:
- `--format`(_string_) (choices: `modelgen`, `graphql-codegen`, `introspection`) - Specifies the format of the GraphQL client code to be generated.
- `--model-target` (_string_) (choices: `java`, `swift`, `javascript`, `typescript`, `dart`) - Specifies the modelgen export target. Only applies when the --format parameter is set to modelgen.
- `--statement-target`(_string_) (choices: `javascript`, `graphql`, `flow`, `typescript`, `angular`) - Specifies the graphql-codegen statement export target. Only applies when the --format parameter is set to graphql-codegen.
- `--statement-max-depth`(_integer_) - Specifies the maximum depth of the generated GraphQL statements. Only applies when the --format parameter is set to graphql-codegen.
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a valid CLI option? I'm not seeing it in the help, but if it is we should get it added to the help

ampx generate graphql-client-code

Generates graphql API code

Stack identifier
  --stack  A stack name that contains an Amplify backend                [string]

Project identifier
  --app-id  The Amplify App ID of the project                           [string]
  --branch  A git branch of the Amplify project                         [string]

Options:
  --debug             Print debug logs to the console [boolean] [default: false]
  --help              Show help                                        [boolean]
  --profile           An AWS profile name.                              [string]
  --out               A path to directory where config is written. If not provid
                      ed defaults to current process working directory. [string]
  --format            The format that the GraphQL client code should be generate
                      d in.
              [string] [choices: "modelgen", "graphql-codegen", "introspection"]
  --model-target      The modelgen export target. Only applies when the `--forma
                      t` parameter is set to `modelgen`
         [string] [choices: "java", "swift", "javascript", "typescript", "dart"]
  --statement-target  The graphql-codegen statement export target. Only applies
                      when the `--format` parameter is set to `graphql-codegen`
    [string] [choices: "javascript", "graphql", "flow", "typescript", "angular"]
  --type-target       The optional graphql-codegen type export target. Only appl
                      ies when the `--format` parameter is set to `graphql-codeg
                      en`
  [string] [choices: "json", "swift", "typescript", "flow", "scala", "flow-moder
                                                                  n", "angular"]
  --all               Show hidden options                              [boolean]

Copy link
Member Author

@chrisbonifacio chrisbonifacio May 22, 2024

Choose a reason for hiding this comment

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

It is and we should!

Copy link
Contributor

Choose a reason for hiding this comment

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

would you mind filing a quick bug report for this in the backend repo? are there any other options we should add?

(in the future I'd like to generate this page from the CLI itself)

Copy link
Member Author

@chrisbonifacio chrisbonifacio May 22, 2024

Choose a reason for hiding this comment

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

Done! aws-amplify/amplify-backend#1546

Not aware of other missing options, scanned through the amplify-backend codebase and found where the commands are listed. Some are missing but are explicitly set to be hidden.

https://github.com/aws-amplify/amplify-backend/blob/4e7d59fb8226830e0c58dc48b2efd28d56254470/packages/cli/src/commands/generate/graphql-client-code/generate_graphql_client_code_command.ts#L207

- `--type-target`(_string_) (choices: `json`, `swift`, `typescript`, `flow`, `scala`, `flow-modern`, `angular`) - Specifies the optional graphql-codegen type export target. Only applies when the --format parameter is set to graphql-codegen.
- `--all`(_boolean_)- Shows hidden options.
- `--profile`(_string_) - Specifies an AWS profile name.
Expand All @@ -260,7 +261,7 @@ Optional parameters:
<SubCommandHeading parentCommand="ampx-generate-graphql-client-code">Usage</SubCommandHeading>


### Generate GraphQL client code using the Amplify App ID and branch.
### Generate GraphQL client code using the Amplify App ID and branch.

```bash title="Terminal" showLineNumbers={false}
npx ampx generate graphql-client-code --app-id <your-amplify-app-id> --branch staging
Expand Down Expand Up @@ -301,7 +302,7 @@ Run Amplify codegen command to generate GraphQL codegen:

```bash title="Terminal" showLineNumbers={false}
npx ampx generate graphql-client-code --stack Backend --platform ts --out ./src
```
```

### Generate codegen in specific language and format

Expand Down
Loading