On Wednesday, February 15, 2017 at 12:11:39 PM UTC+11, Richard Walker wrote: > > Just getting started with using Swagger-Core Annotations on some JAX-RS > services (using Jersey implementation). > > Using the JerseyJaxrsConfig servlet to generate swagger.json. Using > swagger-ui to see a "pretty" version of the annotations. (Using sample > ApiOriginFilter to solve CORS issues.) > > Pretty happy so far, but wondering how to tweak things in a few cases. > > First, my setup: >
<snip> > The Vocabulary class is generated using xjc from an XML Schema. So it has > many JAXB annotations: @XmlRootElement , @XmlType, and @XmlAccessorType on > the class, and @XmlElement/@XmlAttribute on the fields. > > There is also a package-info.java file generated, which contains this: > > @javax.xml.bind.annotation.XmlSchema(namespace = " > http://vocabs.ands.org.au/registry/schema/2017/01/vocabulary", > elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) > package au.org.ands.vocabs.registry.schema.vocabulary201701; > <snip> > Now to my "issues", which are related to how swagger-ui presents the > "Example Value" for XML. > <snip> Issue #2: XML namespace for the Vocabulary. > > The Example Value doesn't include the XML namespace for the Vocabulary > element. It seems the @XmlSchema annotation in package-info.java is not > taken into account. > I think I need to file a GitHub issue for this. But I have found a workaround that may be good enough for me: add the "-npa" command-line option to the xjc command. Then, namespace properties are added at the class level, and swagger-core then correctly adds them to the generated swagger.json. The side effect of the -npa option is that package-info.java is no longer generated _at all_, so I have to make one by hand. Not a big problem. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
