You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniyar Yeralin (JIRA)" <ji...@apache.org> on 2017/11/14 21:10:00 UTC
[jira] [Commented] (CXF-7563) Swagger.json is generated with
modified URI (appens '_1')
[ https://issues.apache.org/jira/browse/CXF-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16252179#comment-16252179 ]
Daniyar Yeralin commented on CXF-7563:
--------------------------------------
Interesting observation: when beans' classes are placed under one package (i.e. put SampleService and SampleServiceInternal under `reproduce.bug.demo.service`), URI will be rendered fine (without '_1').
> Swagger.json is generated with modified URI (appens '_1')
> ---------------------------------------------------------
>
> Key: CXF-7563
> URL: https://issues.apache.org/jira/browse/CXF-7563
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Environment: Tested on two systems:
> 1) Darwin 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64
> 2) Linux 2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Mar 21 12:19:18 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
> Reporter: Daniyar Yeralin
> Priority: Minor
>
> When using SpringBoot + JAX-RS server (with two service beans from *2 separate packages*) combined with Swagger2Feature (to generate swagger.json for provided ServiceBeans), URIs for these services get appended with '_1' (under "operationId" inside swagger.json)
> Sample (Gradle + IDEA) project:
> https://github.com/yeralin/ReproduceBug-CXF-7563-
> Structure:
> !https://i.imgur.com/Q0hh4O3.png!
> Sample Java class:
> {code:java}
> @SpringBootApplication
> public class DemoApplication {
> @Autowired
> private SampleService sampleService;
> @Autowired
> private SampleServiceInternal sampleServiceInternal;
> public static void main(String[] args) {
> SpringApplication.run(DemoApplication.class, args);
> }
> @Bean(destroyMethod = "shutdown")
> public SpringBus cxf() {
> return new SpringBus();
> }
> @Bean(destroyMethod = "destroy")
> @DependsOn("cxf")
> public Server jaxRsServer() {
> final JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
> factory.setServiceBeans(Arrays.asList(sampleService, sampleServiceInternal));
> factory.setBus(cxf());
> factory.setAddress("/");
> factory.setFeatures(Arrays.asList(configureSwagger()));
> return factory.create();
> }
> private Swagger2Feature configureSwagger() {
> Swagger2Feature feature = new Swagger2Feature();
> feature.setBasePath("/");
> return feature;
> }
> }
> {code}
> Swagger.json:
> {code:json}
> // 20171114155626
> // http://localhost:17070/services/swagger.json
> {
> "swagger": "2.0",
> "info": {
> "description": "The Application",
> "version": "1.0.0",
> "title": "Sample REST Application",
> "contact": {
> "name": "users@cxf.apache.org"
> },
> "license": {
> "name": "Apache 2.0 License",
> "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
> }
> },
> "basePath": "/services",
> "tags": Array[2][
> {
> "name": "internal"
> },
> {
> "name": "test"
> }
> ],
> "paths": {
> "/Internal/internal": {
> "get": {
> "tags": Array[1][
> "internal"
> ],
> "operationId": "getInternal_1",
> "parameters": Array[0][
>
> ],
> "responses": {
> "200": {
> "description": "successful operation",
> "schema": {
> "type": "string"
> },
> "headers": {
>
> }
> }
> }
> }
> },
> "/test/test": {
> "get": {
> "tags": Array[1][
> "test"
> ],
> "operationId": "getTest_1",
> "parameters": Array[0][
>
> ],
> "responses": {
> "200": {
> "description": "successful operation",
> "schema": {
> "type": "string"
> },
> "headers": {
>
> }
> }
> }
> }
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)