Skip to content

export operations interface #341

@gr2m

Description

@gr2m

As suggested in my comment at #236 (comment), I'd prefer to export an operations interface, besides paths and components.

Instead of setting the types for each operation in the paths object, I'd reference an operation key using the operations ID`. In the example of the GitHub OpenAPI schema,

export interface paths {
  "/": {
    /**
     * Get Hypermedia links to resources accessible in GitHub's REST API
     */
    get: {
      // ...
    }
  }
}

would result in

export interface paths {
  "/": {
    get: operations["meta/root"]
  }
}
export interface operations {
  /**
   * Get Hypermedia links to resources accessible in GitHub's REST API
   */
  "meta/root": {
     // ...
  }
}

operationIds are great to generate SDK methods. Having the operation export with direct access to operation types would make it easier to access the operation types for parameters and responses

Metadata

Metadata

Assignees

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