Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Loss array.items.type when with xml #6238

Open
4 tasks done
albertxavier100 opened this issue Mar 4, 2025 · 1 comment
Open
4 tasks done

[Bug]: Loss array.items.type when with xml #6238

albertxavier100 opened this issue Mar 4, 2025 · 1 comment
Assignees
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter

Comments

@albertxavier100
Copy link
Contributor

albertxavier100 commented Mar 4, 2025

Describe the bug

Playground

The arr.items has no property type: string.

Reproduction

Add to playgound:

import "@typespec/http";
import "@typespec/xml";

using TypeSpec.Http;
using TypeSpec.Xml;
@service
namespace Foo;

@name("A_xml")
scalar A extends string;

@name("B_xml")
scalar B extends A;

scalar AA extends string;
scalar BB extends AA;


model Book {
  arr: B[];
  arr2: A[];
  arr3: BB[];
}

Outupt:

openapi: 3.1.0
info:
  title: (title)
  version: 0.0.0
tags: []
paths: {}
components:
  schemas:
    A:
      type: string
      xml:
        name: A_xml
    AA:
      type: string
    B:
      type: string
      xml:
        name: B_xml
    BB:
      type: string
    Book:
      type: object
      required:
        - arr
        - arr2
        - arr3
      properties:
        arr:
          type: array
          items:
            # ---> no type, unexpected
            xml:
              name: B_xml
          xml:
            wrapped: true
        arr2:
          type: array
          items:
            type: string # ---> expected
            xml:
              name: A_xml
          xml:
            wrapped: true
        arr3:
          type: array
          items:
            xml:
              name: BB
          xml:
            wrapped: true

Checklist

@albertxavier100 albertxavier100 added the bug Something isn't working label Mar 4, 2025
@wanlwanl wanlwanl self-assigned this Mar 4, 2025
@wanlwanl wanlwanl added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Mar 4, 2025
@wanlwanl
Copy link
Member

wanlwanl commented Mar 4, 2025

@skywing918 could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter
Projects
None yet
Development

No branches or pull requests

2 participants