Troubles with WADL / generated XSD using Jersey with a contract-first approach

前端 未结 1 409
长发绾君心
长发绾君心 2021-02-03 17:21

I have been working on a REST web service using Jersey for a few days now, and managed to have all CRUD operations working, with several exchange formats: XML, JSON, Google Prot

1条回答
  •  一向
    一向 (楼主)
    2021-02-03 17:44

    1.14-SNAPSHOT should allow you to do this:

    public class SampleWadlGeneratorConfig extends WadlGeneratorConfig {
    
        @Override
        public List configure() {
            return generator( WadlGeneratorApplicationDoc.class )
                    .prop( "applicationDocsStream", "application-doc.xml" )
                    .generator( WadlGeneratorGrammarsSupport.class )
                    .prop( "grammarsStream", "application-grammars.xml" )
                    .prop("overrideGrammars", true)                               // !!!
                    .generator( WadlGeneratorResourceDocSupport.class )
                    .prop( "resourceDocStream", "resourcedoc.xml" )
                    .descriptions();
        }
    
    }
    

    when overrideGrammars is set to true, Jersey generated grammars won't be included in returned WADL.

    0 讨论(0)
提交回复
热议问题