Skip to content

Post-process generated OpenAPI documentation to fix content type inconsistencies #20

@coderabbitai

Description

@coderabbitai

Background

When using the HttpBody mechanism for gRPC to REST mapping in the API, the server can send responses with any content type and will set the Content-Type header accordingly at runtime. However, the OpenAPI specification generated by protoc-gen-openapiv2 cannot correctly represent this dynamic behavior, always showing application/json in the documentation.

Example

In PR #19, a new endpoint was added: /api/fulfillment/v1/clusters/{cluster_id}/kubeconfig

This endpoint returns YAML content with content type application/yaml, but the generated OpenAPI documentation shows it as returning application/json.

Proposed Solution

We need to implement a post-processing step for the generated OpenAPI documentation to correct these inconsistencies, ensuring that the documentation accurately reflects the API's actual behavior.

This issue was identified in the following discussion: #19 (comment)

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