Skip to content

Commit

Permalink
Changes report: Sort request methods #1878
Browse files Browse the repository at this point in the history
  • Loading branch information
bnasslahsen committed Oct 16, 2022
1 parent c14234f commit c655c42
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 1 deletion.
Expand Up @@ -44,6 +44,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -397,7 +398,7 @@ protected void calculatePath(HandlerMethod handlerMethod, RouterOperation router
routerOperation = customizeRouterOperation(routerOperation, handlerMethod);

String operationPath = routerOperation.getPath();
Set<RequestMethod> requestMethods = new HashSet<>(Arrays.asList(routerOperation.getMethods()));
Set<RequestMethod> requestMethods = new TreeSet<>(Arrays.asList(routerOperation.getMethods()));
io.swagger.v3.oas.annotations.Operation apiOperation = routerOperation.getOperation();
String[] methodConsumes = routerOperation.getConsumes();
String[] methodProduces = routerOperation.getProduces();
Expand Down
@@ -0,0 +1,34 @@
/*
*
* * Copyright 2019-2020 the original author or authors.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * https://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package test.org.springdoc.api.app167;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* The type Hello controller.
*/
@RestController("/api")
public class HelloController {

@RequestMapping("/process")
public void process() {

}
}
@@ -0,0 +1,36 @@
/*
*
* * Copyright 2019-2020 the original author or authors.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * https://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package test.org.springdoc.api.app167;

import test.org.springdoc.api.AbstractSpringDocTest;

import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* The type Spring doc app 167 test.
*/
public class SpringDocApp167Test extends AbstractSpringDocTest {

/**
* The type Spring doc test app.
*/
@SpringBootApplication
static class SpringDocTestApp {
}
}
@@ -0,0 +1,101 @@
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost",
"description": "Generated server url"
}
],
"tags": [
{
"name": "hello-controller",
"description": "The type Hello controller."
}
],
"paths": {
"/process": {
"get": {
"tags": [
"hello-controller"
],
"operationId": "process",
"responses": {
"200": {
"description": "OK"
}
}
},
"put": {
"tags": [
"hello-controller"
],
"operationId": "process_3",
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"tags": [
"hello-controller"
],
"operationId": "process_2",
"responses": {
"200": {
"description": "OK"
}
}
},
"delete": {
"tags": [
"hello-controller"
],
"operationId": "process_5",
"responses": {
"200": {
"description": "OK"
}
}
},
"options": {
"tags": [
"hello-controller"
],
"operationId": "process_6",
"responses": {
"200": {
"description": "OK"
}
}
},
"head": {
"tags": [
"hello-controller"
],
"operationId": "process_1",
"responses": {
"200": {
"description": "OK"
}
}
},
"patch": {
"tags": [
"hello-controller"
],
"operationId": "process_4",
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"components": {}
}

0 comments on commit c655c42

Please sign in to comment.