Skip to content

Infer consumers/producers from OpenAPI spec instead of hardcoding defaults #385

@fredbi

Description

@fredbi

Source Location

File: client/runtime.go
Line: 235
Function: func New(host, basePath string, schemes []string) *Runtime

Context

This TODO appears in the New() constructor where default Consumers and Producers are hardcoded for various MIME types (JSON, YAML, XML, CSV, Text, HTML, ByteStream).

Analysis

The current implementation registers a fixed set of consumers/producers regardless of what the OpenAPI spec actually declares in its consumes/produces sections. The enhancement would involve:

  • Reading the spec's consumes array to register only needed consumers
  • Reading the spec's produces array to register only needed producers
  • This would avoid registering unused handlers and ensure the client matches the API's declared capabilities

Original Comment

// TODO: actually infer this stuff from the spec

This issue was created to track a TODO comment in the codebase.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions