Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit f88b4fc

Browse files
committed
Adds component security scheme docs
1 parent 3bc5928 commit f88b4fc

File tree

12 files changed

+161
-87
lines changed

12 files changed

+161
-87
lines changed

samples/client/petstore/java/.openapi-generator/FILES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ docs/components/schemas/UUIDString.md
156156
docs/components/schemas/User.md
157157
docs/components/schemas/Whale.md
158158
docs/components/schemas/Zebra.md
159+
docs/components/securityschemes/ApiKey.md
160+
docs/components/securityschemes/ApiKeyQuery.md
161+
docs/components/securityschemes/BearerTest.md
162+
docs/components/securityschemes/HttpBasicTest.md
163+
docs/components/securityschemes/HttpSignatureTest.md
164+
docs/components/securityschemes/OpenIdConnectTest.md
165+
docs/components/securityschemes/PetstoreAuth.md
159166
docs/paths/anotherfakedummy/patch/responses/response200/content/applicationjson/Schema.md
160167
docs/paths/commonparamsubdir/delete/parameters/parameter0/Schema0.md
161168
docs/paths/commonparamsubdir/delete/parameters/parameter1/Schema1.md

samples/client/petstore/java/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ allowed input and output types.
303303

304304
| Class | Description |
305305
| ----- | ----------- |
306-
| [ApiKey](docs/components/securitysschemes/ApiKey.md) | apiKey in header |
307-
| [ApiKeyQuery](docs/components/securitysschemes/ApiKeyQuery.md) | apiKey in query |
308-
| [BearerTest](docs/components/securitysschemes/BearerTest.md) | http bearer with JWT bearer format |
306+
| [ApiKey](docs/components/securityschemes/ApiKey.md) | apiKey in header |
307+
| [ApiKeyQuery](docs/components/securityschemes/ApiKeyQuery.md) | apiKey in query |
308+
| [BearerTest](docs/components/securityschemes/BearerTest.md) | http bearer with JWT bearer format |
309309
| [HttpBasicTest](docs/components/securitysschemes/HttpBasicTest.md) | http basic |
310-
| [HttpSignatureTest](docs/components/securitysschemes/HttpSignatureTest.md) | http + signature |
311-
| [OpenIdConnectTest](docs/components/securitysschemes/OpenIdConnectTest.md) | openIdConnect |
312-
| [PetstoreAuth](docs/components/securitysschemes/PetstoreAuth.md) | oauth2 implicit flow with two scopes |
310+
| [HttpSignatureTest](docs/components/securityschemes/HttpSignatureTest.md) | http + signature |
311+
| [OpenIdConnectTest](docs/components/securityschemes/OpenIdConnectTest.md) | openIdConnect |
312+
| [PetstoreAuth](docs/components/securityschemes/PetstoreAuth.md) | oauth2 implicit flow with two scopes |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
org.openapijsonschematools.client.components.security_schemes.ApiKey
2+
# SecurityScheme ApiKey
3+
4+
## Description
5+
apiKey in header
6+
7+
## Type
8+
API_KEY
9+
10+
## Name
11+
"api_key"
12+
13+
## api_key
14+
Type | Notes
15+
---- | ------
16+
str | Set by the developer
17+
18+
## In Location
19+
ApiKeyInLocation.HEADER
20+
21+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
org.openapijsonschematools.client.components.security_schemes.ApiKeyQuery
2+
# SecurityScheme ApiKeyQuery
3+
4+
## Description
5+
apiKey in query
6+
7+
## Type
8+
API_KEY
9+
10+
## Name
11+
"api_key_query"
12+
13+
## api_key
14+
Type | Notes
15+
---- | ------
16+
str | Set by the developer
17+
18+
## In Location
19+
ApiKeyInLocation.QUERY
20+
21+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
org.openapijsonschematools.client.components.security_schemes.BearerTest
2+
# SecurityScheme BearerTest
3+
4+
## Description
5+
http bearer with JWT bearer format
6+
7+
## Type
8+
HTTP
9+
10+
## Scheme
11+
BEARER
12+
13+
## Bearer Format
14+
"JWT"
15+
16+
## access_token
17+
Type | Notes
18+
---- | ------
19+
str | Set by the developer
20+
21+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
org.openapijsonschematools.client.components.security_schemes.HttpBasicTest
2+
# SecurityScheme HttpBasicTest
3+
4+
## Description
5+
http basic
6+
7+
## Type
8+
HTTP
9+
10+
## Scheme
11+
BASIC
12+
13+
## user_id
14+
Type | Notes
15+
---- | ------
16+
str | Set by the developer
17+
18+
## password
19+
Type | Notes
20+
---- | ------
21+
str | Set by the developer
22+
23+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
org.openapijsonschematools.client.components.security_schemes.HttpSignatureTest
2+
# SecurityScheme HttpSignatureTest
3+
4+
## Description
5+
http + signature
6+
7+
## Type
8+
HTTP
9+
10+
## Scheme
11+
SIGNATURE
12+
13+
## signing_info
14+
Type | Notes
15+
---- | ------
16+
org.openapijsonschematools.client.signing.HttpSigningConfiguration | Set by the developer
17+
18+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
org.openapijsonschematools.client.components.security_schemes.OpenIdConnectTest
2+
# SecurityScheme OpenIdConnectTest
3+
4+
## Description
5+
openIdConnect
6+
7+
## Type
8+
OPENID_CONNECT
9+
10+
## OpenIdConnect Url
11+
"https://somesite.com/.well-known/openid-configuration"
12+
13+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
org.openapijsonschematools.client.components.security_schemes.PetstoreAuth
2+
# SecurityScheme PetstoreAuth
3+
4+
## Description
5+
oauth2 implicit flow with two scopes
6+
7+
## Type
8+
OAUTH_2
9+
10+
[[Back to top]](#top) [[Back to Component Security Schemes]](../../../README.md#Component-SecuritySchemes) [[Back to README]](../../../README.md)

src/main/java/org/openapijsonschematools/codegen/generators/JavaClientGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,12 @@ public void setOpenAPI(OpenAPI openAPI) {
24132413
put("src/main/java/packagename/components/securityschemes/SecurityScheme.hbs", ".java");
24142414
}}
24152415
);
2416+
jsonPathDocTemplateFiles.put(
2417+
CodegenConstants.JSON_PATH_LOCATION_TYPE.SECURITY_SCHEME,
2418+
new HashMap<>() {{
2419+
put("src/main/java/packagename/components/securityschemes/SecurityScheme_doc.hbs", ".md");
2420+
}}
2421+
);
24162422
}
24172423
List<Server> servers = openAPI.getServers();
24182424
if (servers != null && !servers.isEmpty()) {

src/main/resources/java/README.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ allowed input and output types.
181181
| ----- | ----------- |
182182
{{#each securitySchemes}}
183183
{{#with this}}
184-
| [{{jsonPathPiece.pascalCase}}](docs/components/securitysschemes/{{jsonPathPiece.snakeCase}}.md) |{{#if description}} {{description.originalWithBr}}{{/if}} |
184+
| [{{jsonPathPiece.pascalCase}}](docs/components/securityschemes/{{jsonPathPiece.snakeCase}}.md) |{{#if description}} {{description.originalWithBr}}{{/if}} |
185185
{{/with}}
186186
{{/each}}
187187
{{/if}}

src/main/resources/java/src/main/java/packagename/components/securityschemes/SecurityScheme_doc.hbs

Lines changed: 14 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{packageName}}.components.security_schemes.{{jsonPathPiece.snakeCase}}
44
{{/if}}
55
{{#eq identifierPieces.size 0}}
6-
{{> components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces "SecurityScheme" jsonPathPiece) }}
6+
{{> src/main/java/packagename/components/_helper_header_from_identifier_pieces identifierPieces=(append identifierPieces "SecurityScheme" jsonPathPiece) }}
77
{{/eq}}
88
{{#if description}}
99

@@ -18,7 +18,7 @@
1818

1919
{{headerSize}}# Type
2020
{{#eq type "apiKey"}}
21-
security_schemes.SecuritySchemeType.API_KEY
21+
API_KEY
2222

2323
{{headerSize}}# Name
2424
"{{name}}"
@@ -30,23 +30,23 @@ str | Set by the developer
3030
3131
{{headerSize}}# In Location
3232
{{#eq in "query"}}
33-
security_schemes.ApiKeyInLocation.QUERY
33+
ApiKeyInLocation.QUERY
3434
{{else}}
3535
{{#eq in "header"}}
36-
security_schemes.ApiKeyInLocation.HEADER
36+
ApiKeyInLocation.HEADER
3737
{{else}}
3838
{{#eq in "cookie"}}
39-
security_schemes.ApiKeyInLocation.COOKIE
39+
ApiKeyInLocation.COOKIE
4040
{{/eq}}
4141
{{/eq}}
4242
{{/eq}}
4343
{{else}}
4444
{{#eq type "http"}}
45-
security_schemes.SecuritySchemeType.HTTP
45+
HTTP
4646
{{#eq scheme "basic"}}
4747
4848
{{headerSize}}# Scheme
49-
security_schemes.HTTPSchemeType.BASIC
49+
BASIC
5050
5151
{{headerSize}}# user_id
5252
Type | Notes
@@ -61,7 +61,7 @@ str | Set by the developer
6161
{{#eq scheme "bearer"}}
6262
6363
{{headerSize}}# Scheme
64-
security_schemes.HTTPSchemeType.BEARER
64+
BEARER
6565
{{#if bearerFormat}}
6666
6767
{{headerSize}}# Bearer Format
@@ -76,12 +76,12 @@ str | Set by the developer
7676
{{#eq scheme "digest"}}
7777
7878
{{headerSize}}# Scheme
79-
security_schemes.HTTPSchemeType.DIGEST
79+
DIGEST
8080
{{else}}
8181
{{#eq scheme "signature"}}
8282
8383
{{headerSize}}# Scheme
84-
security_schemes.HTTPSchemeType.SIGNATURE
84+
SIGNATURE
8585
8686
{{headerSize}}# signing_info
8787
Type | Notes
@@ -93,79 +93,13 @@ Type | Notes
9393
{{/eq}}
9494
{{else}}
9595
{{#eq type "mutualTLS"}}
96-
security_schemes.SecuritySchemeType.MUTUAL_TLS
96+
MUTUAL_TLS
9797
{{else}}
9898
{{#eq type "oauth2"}}
99-
security_schemes.SecuritySchemeType.OAUTH_2
100-
101-
{{headerSize}}# Flows
102-
{{#with flows}}
103-
{{#with implicit}}
104-
{{headerSize}}# Implicit Flow
105-
{{#if refreshUrl}}
106-
{{headerSize}}## Refresh Url
107-
"{{refreshUrl}}"
108-
{{/if}}
109-
{{headerSize}}## Scopes
110-
Scope Name | Scope Description
111-
| -------- | ---------------- |
112-
{{#each scopes}}
113-
"{{@key}}" | {{this}}
114-
{{/each}}
115-
{{headerSize}}## Authorization Url
116-
"{{authorizationUrl}}"
117-
{{/with}}
118-
{{#with password}}
119-
{{headerSize}}# Password Flow
120-
{{#if refreshUrl}}
121-
{{headerSize}}## Refresh Url
122-
"{{refreshUrl}}"
123-
{{/if}}
124-
{{headerSize}}## Scopes
125-
Scope Name | Scope Description
126-
| -------- | ---------------- |
127-
{{#each scopes}}
128-
"{{@key}}" | {{this}}
129-
{{/each}}
130-
{{headerSize}}## Token Url
131-
"{{tokenUrl}}"
132-
{{/with}}
133-
{{#with clientCredentials}}
134-
{{headerSize}}# ClientCredentials Flow
135-
{{#if refreshUrl}}
136-
{{headerSize}}## Refresh Url
137-
"{{refreshUrl}}"
138-
{{/if}}
139-
{{headerSize}}## Scopes
140-
Scope Name | Scope Description
141-
| -------- | ---------------- |
142-
{{#each scopes}}
143-
"{{@key}}" | {{this}}
144-
{{/each}}
145-
{{headerSize}}## Token Url
146-
"{{tokenUrl}}"
147-
{{/with}}
148-
{{#with authorizationCode}}
149-
{{headerSize}}# AuthorizationCode Flow
150-
{{#if refreshUrl}}
151-
{{headerSize}}## Refresh Url
152-
"{{refreshUrl}}"
153-
{{/if}}
154-
{{headerSize}}## Scopes
155-
Scope Name | Scope Description
156-
| -------- | ---------------- |
157-
{{#each scopes}}
158-
"{{@key}}" | {{this}}
159-
{{/each}}
160-
{{headerSize}}## Authorization Url
161-
"{{authorizationUrl}}"
162-
{{headerSize}}## Token Url
163-
"{{tokenUrl}}"
164-
{{/with}}
165-
{{/with}}
99+
OAUTH_2
166100
{{else}}
167101
{{#eq type "openIdConnect"}}
168-
security_schemes.SecuritySchemeType.OPENID_CONNECT
102+
OPENID_CONNECT
169103
170104
{{headerSize}}# OpenIdConnect Url
171105
"{{openIdConnectUrl}}"
@@ -178,5 +112,5 @@ security_schemes.SecuritySchemeType.OPENID_CONNECT
178112
179113
[[Back to top]](#top) {{> _helper_footer_links readmePath="../../../" securitySchemesLink=true}}
180114
{{/if}}
181-
{{/if}}
115+
{{/if}
182116
{{/with}}

0 commit comments

Comments
 (0)