Skip to content

[CLI] Create cg check api command #65

Closed as not planned
Closed as not planned

Description

@widal001

Validating a CommonGrants API implementation

User story

As a developer implementing a CommonGrants API, I want to run a command that checks whether a given API matches an OpenAPI spec, so that I can catch inconsistencies between the spec and the implementation.

Developer experience

cg check api <url-for-root-of-the-api> <path-to-typespec-or-open-api-spec>

Additional Features

  • Allow selecting the HTTP client for validation (e.g., curl, httpx).
  • Provide an option to generate a report (--report json or --report html).
  • Support authentication with --auth flag for APIs requiring credentials.

Example Usage

# Validate a running API against a spec
cg check api https://api.example.com grants-api.yaml

# Validate using a different HTTP client
cg check api https://api.example.com grants-api.yaml --client httpx

# Validate an authenticated API
cg check api https://api.example.com grants-api.yaml --auth bearer:mytoken

# Generate a validation report in JSON format
cg check api https://api.example.com grants-api.yaml --report json

Technical details

  • This command should leverage existing tools that validate OpenAPI spec implementations, where possible.

Activity

  1. added
    cliIssue or PR related to the @common-grants/cli library
    on Jan 30, 2025
  2. changed the title [-][CLI] validating a commongrants api implementation[/-] [+][CLI] Create `cg check api` command[/+] on Jan 30, 2025
  3. self-assigned this
    on Feb 4, 2025
  4. removed their assignment
    on Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions