Skip to content

openapi / primate/client #225

@terrablue

Description

@terrablue

npx primate client <open-api-definition.json> [--backend=ts]
-> should generate a typed client for the given backend

api perhaps something like

given

openapi: 3.0.3
info:
  title: User API
  version: 1.0.0
paths:
  /users/{id}:
    post:
      summary: Update user
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                email:
                  type: string
      responses:
        '200':
          description: User updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  name:
                    type: string
                  email:
                    type: string

client(/* oauth creds */).users(id: number).post(/* headers, query params */) -> { id: number; name: string; email: string }

open questions:

  • client size
  • is a fluent API client tree-shakeable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions