Qualify namespaced OpenAPI XML attributes (#598)

This commit is contained in:
Gregory Schier
2026-08-19 22:30:50 -07:00
committed by GitHub
parent 7db652db57
commit 95b1beffcf
2 changed files with 75 additions and 9 deletions
+29 -1
View File
@@ -1043,6 +1043,31 @@ describe("importer-openapi", () => {
example: "42",
xml: { attribute: true, namespace: "urn:metadata", prefix: "m" },
},
externalId: {
type: "string",
example: "external",
xml: {
attribute: true,
name: "external-id",
namespace: "urn:external",
prefix: "ns1",
},
},
tenant: {
type: "string",
example: "acme",
xml: { attribute: true, namespace: "urn:tenant" },
},
region: {
type: "string",
example: "west",
xml: { attribute: true, namespace: "urn:tenant" },
},
legacy: {
type: "string",
example: "plain",
xml: { attribute: true, namespace: "", prefix: "unbound" },
},
tags: {
type: "array",
example: ["one", "two"],
@@ -1094,7 +1119,10 @@ describe("importer-openapi", () => {
expect(imported?.resources.httpRequests[0]?.body).toEqual({
text:
'<c:catalog xmlns:c="urn:catalog" xmlns:m="urn:metadata" m:id="42">' +
'<c:catalog xmlns:c="urn:catalog" xmlns:m="urn:metadata" ' +
'xmlns:ns1="urn:external" xmlns:ns2="urn:tenant" ' +
'm:id="42" ns1:external-id="external" ns2:tenant="acme" ns2:region="west" ' +
'legacy="plain">' +
'<t:tags xmlns:t="urn:tags"><tag>one</tag><tag>two</tag></t:tags>' +
'<a:alias xmlns:a="urn:aliases">Ada</a:alias>' +
'<a:alias xmlns:a="urn:aliases">A</a:alias>' +