mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
Adding tests for query params
This commit is contained in:
@@ -499,16 +499,62 @@ public class JetbrainsHttpClientClientCodegenTest {
|
||||
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
Path path = Paths.get(output + "/Apis/BasicApi.http");
|
||||
Path path = Paths.get(output + "/Apis/DefaultApi.http");
|
||||
assertFileExists(path);
|
||||
|
||||
// Checking first and last
|
||||
// Checking with extra params
|
||||
TestUtils.assertFileContains(path, "### Get User Info by Query Param\n" +
|
||||
"## Get User Info by Query Param\n" +
|
||||
"GET http://localhost:5000/v1/users/?page={{page}}&pUserId={{pUserId}}&api_key={{queryKey}}\n" +
|
||||
"Accept: application/json\n" +
|
||||
"Custom-Header: {{customHeader}}\n" +
|
||||
"Another-Custom-Header: {{anotherCustomHeader}}");
|
||||
|
||||
// Checking without extra params
|
||||
TestUtils.assertFileContains(path, "### Get User Info by User ID\n" +
|
||||
"## Get User Info by User ID\n" +
|
||||
"GET http://localhost:5000/v1/users/{{userId}}?api_key={{queryKey}}\n" +
|
||||
"Accept: application/json\n" +
|
||||
"strCode: {{strCode}}\n" +
|
||||
"strCode2: {{strCode2}}");
|
||||
|
||||
// Checking with only auth
|
||||
TestUtils.assertFileContains(path, "### Get User Info by User ID\n" +
|
||||
"## Get User Info by User ID\n" +
|
||||
"GET http://localhost:5000/v1/users/{{userId}}?api_key={{queryKey}}\n" +
|
||||
"Accept: application/json\n" +
|
||||
"strCode: {{strCode}}\n" +
|
||||
"strCode2: {{strCode2}}");
|
||||
|
||||
// Checking with only param
|
||||
TestUtils.assertFileContains(path, "### Update User Information\n" +
|
||||
"## Update User Information\n" +
|
||||
"PATCH http://localhost:5000/v1/users/{{userId}}?page={{page}}\n" +
|
||||
"Content-Type: application/json\n" +
|
||||
"Accept: application/json\n" +
|
||||
"strCode: {{strCode}}\n" +
|
||||
"strCode2: {{strCode2}}\n" +
|
||||
"\n" +
|
||||
"{\n" +
|
||||
" \"firstName\" : \"Rebecca\"\n" +
|
||||
"}");
|
||||
|
||||
// Checking when there is nothing
|
||||
TestUtils.assertFileContains(path, "### Create New User\n" +
|
||||
"## Example request for Get User\n" +
|
||||
"POST http://localhost:5000/v1/user\n" +
|
||||
"Content-Type: application/json\n" +
|
||||
"Accept: application/json\n" +
|
||||
"\n" +
|
||||
"{\n" +
|
||||
" \"id\": 777,\n" +
|
||||
" \"firstName\": \"Alotta\",\n" +
|
||||
" \"lastName\": \"Rotta\",\n" +
|
||||
" \"email\": \"alotta.rotta@gmail.com\",\n" +
|
||||
" \"dateOfBirth\": \"1997-10-31\",\n" +
|
||||
" \"emailVerified\": true,\n" +
|
||||
" \"createDate\": \"2019-08-24\"\n" +
|
||||
"}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,8 +41,6 @@ paths:
|
||||
summary: Get User Info by Query Param
|
||||
operationId: get-users-query-id
|
||||
description: Retrieve the information of the user with the matching user ID.
|
||||
tags:
|
||||
- basic
|
||||
security:
|
||||
- ApiKeyAuthQuery: [ ]
|
||||
parameters:
|
||||
@@ -71,7 +69,6 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
default: abc
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: User Found
|
||||
@@ -136,8 +133,8 @@ paths:
|
||||
description: Code as header2
|
||||
get:
|
||||
summary: Get User Info by User ID
|
||||
tags:
|
||||
- advanced
|
||||
security:
|
||||
- ApiKeyAuthQuery: [ ]
|
||||
responses:
|
||||
'200':
|
||||
description: User Found
|
||||
@@ -161,6 +158,14 @@ paths:
|
||||
summary: Update User Information
|
||||
deprecated: true
|
||||
operationId: patch-users-userId
|
||||
parameters:
|
||||
- description: Page length
|
||||
name: page
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
example: 50
|
||||
responses:
|
||||
'200':
|
||||
description: User Updated
|
||||
@@ -255,13 +260,9 @@ paths:
|
||||
$ref: '#/components/examples/get-user-basic'
|
||||
description: Post the necessary fields for the API to create a new user.
|
||||
description: Create a new user.
|
||||
tags:
|
||||
- basic
|
||||
'/groups/{groupId}':
|
||||
get:
|
||||
summary: Get group by ID
|
||||
tags:
|
||||
- advanced
|
||||
parameters:
|
||||
- description: group Id
|
||||
name: groupId
|
||||
|
||||
Reference in New Issue
Block a user