Skip to content

[CLI] Create cg add field command #60

@widal001

Description

@widal001

Adding a custom field

User story

As a developer defining a CommonGrants API, I want to add a new custom field with configurable options, so that I can extend the API schema easily.

Developer experience

Simplest use case: Add a custom field by specifying name and type.

cg add field <name> <type>

Additional Features

  • Provide an example value with --example.
  • Add a description using --description.

Example Usage

# Add a simple custom field
cg add field fundingAmount number

# Add a custom field with an example value
cg add field fundingAmount number --example 100000

# Add a custom field with a description
cg add field fundingAmount number --description "The total amount of funding available"

Technical details

  • The command should append the new field to the appropriate schema definition in the TypeSpec project.
  • If --example or --description is provided, they should be included as metadata in the schema definition.

Metadata

Metadata

Assignees

Labels

cliIssue or PR related to the @common-grants/cli library

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions