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]: Unexpected xml field #6239

Closed
4 tasks done
albertxavier100 opened this issue Mar 4, 2025 · 2 comments
Closed
4 tasks done

[Bug]: Unexpected xml field #6239

albertxavier100 opened this issue Mar 4, 2025 · 2 comments
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 array arr3 without xml decorators are also get impacted which is unexpected.

Reproduction

Input:

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[];
}

Output:

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:
            xml:
              name: B_xml
          xml:
            wrapped: true
        arr2:
          type: array
          items:
            type: string
            xml:
              name: A_xml
          xml:
            wrapped: true
        arr3:
          type: array
          items:
            xml: # --> why this is impacted?
              name: BB
          xml:
            wrapped: true

Checklist

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

wanlwanl commented Mar 4, 2025

@skywing918 could you take a look?

@skywing918
Copy link
Member

skywing918 commented Mar 5, 2025

Actually, any part of the model book using xml decorators, it will be affected, even if the array arr3 without xml decorators.

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

3 participants