Skip to content

[BUG] Rust wasm32-unknown-unknown build is broken with 7.15.0 #21813

@JMLX42

Description

@JMLX42

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The new async file stream support for reqwest client breaks the WASM build.

  • supportAsync=true (default) implies vendorExtensions.useAsyncFileStream=true, it will add tokio as a dependency with features incompatible with WASM
  • supportAsync=false, it will enable the blocking feature of reqwest, which does not build for WASM
error: Only features sync,macros,io-util,rt,time are supported on wasm.
   --> /home/jmlx/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/lib.rs:475:1
    |
475 | compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.");
    |

So IMHO, essentially, the WASM build is essentially 100% broken on 7.15.0.

openapi-generator version

7.15.0

OpenAPI declaration file content or url
swagger: "2.0"
info:
  title: File Streaming Test API
  version: 1.0.0

paths:
    /upload:
      post:
        consumes:
            - application/octet-stream
        description: Upload a file from the local filesystem
        operationId: uploadFile
        parameters:
          - description: A test file
            in: body
            name: inputStream
            schema:
              format: binary
              type: string
        responses:
          '200':
            description: Success
Generation Details
java ${JAVA_OPTS} -jar ${CODEGEN} generate -i \"${INPUT_FILE}\" \
        -g ${lang} \
        -o ${TMP_PATH} \
        --additional-properties=packageName=gltf_live_client_sdk \
        --additional-properties=publishRustRegistry=false \
        --additional-properties=library=reqwest \
        --additional-properties=avoidBoxedModels=true
Steps to reproduce
  1. Generate the Rust client code
  2. Attempt to build for wasm32-unknown-unknown
Related issues/PRs

#21771

Suggest a fix

useAsyncFileStream should be a Cargo feature

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