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

[CLI] Create cg generate server command #62

Open
widal001 opened this issue Jan 30, 2025 · 0 comments
Open

[CLI] Create cg generate server command #62

widal001 opened this issue Jan 30, 2025 · 0 comments
Assignees
Labels
area: cli Issues related to CLI tools for the protocol

Comments

@widal001
Copy link
Collaborator

Generating server code

User story

As a developer implementing a CommonGrants API, I want to run a command that auto-generates an API server interface from a specification, so that I can follow a pattern of specification-driven development and quickly build APIs from scratch using the CommonGrants library.

Developer experience

cg generate server <path-to-typespec>

Additional Features

  • Allow specifying a language/framework with --lang (e.g., Python, Node.js).
  • Enable plugin support for custom server code generation.
  • Generate only specific components with --only <controllers|models|routes>.

Example Usage

# Generate a server using the default framework
cg generate server grants-api.tsp

# Generate a server for a specific language or framework
cg generate server grants-api.tsp --lang python

# Generate only controllers and routes
cg generate server grants-api.tsp --only controllers,routes

Technical details

  • This may require a combination of TypeSpec emitters and OpenAPI codegen.
  • If an API framework isn't specified by the user via a flag, the CLI should prompt a user to choose one.
  • Ideally, this entry point would be designed to support plugins for custom server code generators.

@widal001 widal001 added the area: cli Issues related to CLI tools for the protocol label Jan 30, 2025
@widal001 widal001 changed the title [CLI] generating server code [CLI] Create cg generate server command Jan 30, 2025
@widal001 widal001 self-assigned this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cli Issues related to CLI tools for the protocol
Projects
Development

No branches or pull requests

1 participant