Skip to content
New issue

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

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

Already on GitHub? # to your account

Define multiple namespace and prefixes for XML requests #1456

Closed
tim-ebner opened this issue Jan 12, 2018 · 2 comments
Closed

Define multiple namespace and prefixes for XML requests #1456

tim-ebner opened this issue Jan 12, 2018 · 2 comments

Comments

@tim-ebner
Copy link

Hi everyone,

I try to model a request which requires xml as request body and multiple namespaces in one xml element:
example:

<Song	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xmlns="http://example.com/Song"
			xmlns:art="http://www.example.com/Artist"
			xsi:schemaLocation="http://www.example.com/Song Song.xsd">
</Song>

I'm currently only able to define just one namespace:

Song:
  type: object
  xml:
    namespace: http://example.com/Song
  properties:
  ....

I think a possible workaround is to declare the other namespace attributes as normal elements and use "attribute: true".
I'm sorry if I misunderstand the usage of namespaces or the openapi xml element.

Is there a proper way to define multiple xml namespaces for one attribute in openapi 3.0.0?

@tim-ebner tim-ebner changed the title How to define multiple namespace and prefixes for XML request Define multiple namespace and prefixes for XML request Jan 12, 2018
@tim-ebner tim-ebner changed the title Define multiple namespace and prefixes for XML request Define multiple namespace and prefixes for XML requests Jan 12, 2018
@MikeRalphson
Copy link
Member

You are correct that multiple xml namespaces are not directly supported by the xml annotations in OpenAPI 3.0.x

I think a possible workaround is to declare the other namespace attributes as normal elements and use "attribute: true".

Your workaround sounds fine, as long as you are not reusing the schema definition for another content-type (such as json), in that case the additional properties would also be considered valid, whereas you might not want that.

@darrelmiller
Copy link
Member

darrelmiller commented Jan 19, 2018

We are considering supporting alternate schemas in v3.1 which would enable this scenario. See #1443

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants