oxidecomputer / oxidecomputer/progenitor

Support for multiple `requestBody` content types

Open
#594 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
136
Avg merge
8h 36m
Merged PRs (30d)
14

Description

In some schemas the requestBody has multiple content types. Here's an example from the github API:

        "operationId": "markdown/render-raw",
        "requestBody": {
          "content": {
            "text/plain": {
              "schema": {
                "type": "string"
              }
            },
            "text/x-markdown": {
              "schema": {
                "type": "string"
              }
            }
          }
        },

In that scenario we'd like to allow consumers to specify either content encoding. I'd suggest we do something like this:

pub enum MarkdownRenderRawBody {
    TextPlain(String),
    XMarkdown(String),
}

fn foo(client: &Client) {
    let _ = client.markdown_render_raw().body(MarkdownRenderRawBody::TextPlain("xyz".to_string())).send.await;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the generator handles OpenAPI requestBody content schemas and how generated request builders expose bodies. Use the GitHub API example in the issue as a case to follow. Done means generated clients accept either listed content type through a typed body API, with coverage for multiple requestBody content types.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.