Skip to content

OpenAPI emitter fails on union with bytes for multipart #10045

@baywet

Description

@baywet

The following definition

import "@typespec/http";
using Http;

union CreateVideoMultipartBodyInputReference {
  bytes,
  ImageRefParam,
}
union ImageRefParam {
  {
    @maxLength(20971520)
    image_url: url,
  },
  {
    file_id: string,
  },
}
model CreateVideoMultipartBody {

  input_reference?: HttpPart<CreateVideoMultipartBodyInputReference>;
}

op createVideo(
  @header
  contentType: "multipart/form-data",

  @multipartBody
  body: CreateVideoMultipartBody,
): void;

Fails with this error message : Duplicate type name: 'CreateVideoMultipartBodyInputReference'. Check @FriendlyName decorators and overlap with types in TypeSpec or service namespace.

Interestingly, if we replace bytes by string or something else, the emission starts working. I'd expect it to work with bytes as well.

Metadata

Metadata

Assignees

Labels

emitter:openapi3Issues for @typespec/openapi3 emitter

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions