Skip to content

Commit 206cef9

Browse files
committed
docs(gdscript): document petstore server ADR
1 parent 141c119 commit 206cef9

File tree

9 files changed

+52
-25
lines changed

9 files changed

+52
-25
lines changed

bin/configs/gdscript-petstore.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,33 @@
22
# bin/generate-samples.sh bin/configs/gdscript-petstore.yaml
33

44
generatorName: gdscript
5+
6+
# We output straight into an addon directory. (any addon name will work)
7+
# The addon need not be enabled in Project Settings to be used, for now,
8+
# but that may change, so as best practice you should enable it anyway.
59
outputDir: samples/client/petstore/gdscript/addons/oas.petstore.client
10+
611
# We have two test servers available.
712
# See https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests
13+
814
# A: Newer, recommended echo server OAS, that we're failing for now:
915
# Exception: Could not process model 'Bird'. Please make sure that your schema is correct!
1016
# Caused by: java.lang.RuntimeException: reserved word color not allowed
17+
# Perhaps try this again later, using another config file like gdscript-echo.yaml
1118
#inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
19+
1220
# B: Older (legacy, deprecated) petstore server OAS
1321
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
22+
1423
templateDir: modules/openapi-generator/src/main/resources/gdscript
24+
1525
additionalProperties:
26+
# Timestamping the generated sample project would only add noise to git
1627
hideGenerationTimestamp: "true"
28+
# Since we're polluting the global namespace with class_name (it's really convenient),
29+
# we can use these prefixes to namespace the generated classes.
30+
# Best make sure the words you use here are not part of the domain of Godot.
31+
# It's a bit cumbersome to have to add all three (idea: globalNamePrefix as sugar?)
1732
apiNamePrefix: Demo
1833
modelNamePrefix: Demo
1934
coreNamePrefix: Demo

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GdscriptClientCodegen.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public String modelDocFileFolder() {
281281
@Override
282282
public String escapeUnsafeCharacters(String input) {
283283
// There might be ways to inject code in Gdscript, but I don't see any for now. (no /* */ comments)
284-
// TODO: review this with someone knowledgeable
284+
// TODO: review this can of worms with someone knowledgeable
285285
return input;
286286
}
287287

@@ -377,14 +377,12 @@ public Map<String, ModelsMap> updateAllModels(Map<String, ModelsMap> objs) {
377377

378378
protected List<String> getReservedWords() {
379379
return Arrays.asList(
380-
// Local properties used in Model classes
381-
"bee_class_name",
382380
// Local method names used in base API class
383-
"bee_connect_client_if_needed", "bee_request", "_bee_request_text", "_bee_do_request_text",
384-
"_bee_convert_http_method", "_bee_urlize_path_param", "_bee_escape_path_param",
385-
"_bee_next_loop_iteration", "_bee_get_content_type", "_bee_format_error_response",
381+
"_bzz_connect_client_if_needed", "bzz_request", "_bzz_request_text", "_bzz_do_request_text",
382+
"_bzz_convert_http_method", "_bzz_urlize_path_param", "_bzz_escape_path_param",
383+
"_bzz_next_loop_iteration", "_bzz_get_content_type", "_bzz_format_error_response",
386384
// Local properties used in base API class
387-
"bee_config", "bee_client", "bee_name",
385+
"_bzz_config", "_bzz_client", "_bzz_name",
388386
// Local variable names used in API methods (endpoints)
389387
"bzz_method", "bzz_path", "bzz_query",
390388
"bzz_result", "bzz_code", "bzz_headers",

samples/client/petstore/gdscript/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@
77
- Returns non-zero exit code upon test failure
88
- Uses [GUT] as test engine
99

10+
11+
## Prepare the test server
12+
13+
See https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests
14+
15+
> We are using the petstore docker, not the echo server for now.
16+
> Feel free to refactor or duplicate the sample demo to use the new echo server.
17+
> See `bin/configs/gdscript-petstore.yaml`.
18+
19+
1020
## Run
1121

1222
godot --headless samples/client/petstore/gdscript
1323

24+
The command should return a zero exit code if all tests passed.
25+
You may want to add `--verbose` for more logs when debugging.
26+
27+
1428
## Update
1529

1630
Refresh the generated files, after modifying the gdscript templates or java generator:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.2.1-SNAPSHOT
1+
6.6.0-SNAPSHOT

samples/client/petstore/gdscript/addons/oas.petstore.client/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,6 @@ Class | Method | HTTP request | Description
100100
## Documentation For Authorization
101101

102102

103-
## api_key
104-
105-
- **Type**: API key
106-
- **API key parameter name**: api_key
107-
- **Location**: HTTP header
108-
109-
Authentication schemes defined for the API:
110103
## petstore_auth
111104

112105
- **Type**: OAuth
@@ -116,6 +109,13 @@ Class | Method | HTTP request | Description
116109
- **write:pets**: modify pets in your account
117110
- **read:pets**: read your pets
118111

112+
Authentication schemes defined for the API:
113+
## api_key
114+
115+
- **Type**: API key
116+
- **API key parameter name**: api_key
117+
- **Location**: HTTP header
118+
119119

120120

121121
## Troubleshooting

samples/client/petstore/gdscript/addons/oas.petstore.client/apis/DemoPetApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ api.upload_file(
405405

406406
### Authorization
407407

408-
[api_key](../README.md#api_key),
409-
[petstore_auth](../README.md#petstore_auth)
408+
[petstore_auth](../README.md#petstore_auth),
409+
[api_key](../README.md#api_key)
410410

411411
[[Back to top]](#__pageTop) \
412412
[[Back to API list]](../README.md#documentation-for-api-endpoints) \

samples/client/petstore/gdscript/addons/oas.petstore.client/apis/DemoStoreApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ api.place_order(
194194

195195
### Authorization
196196

197-
[api_key](../README.md#api_key),
198-
[petstore_auth](../README.md#petstore_auth)
197+
[petstore_auth](../README.md#petstore_auth),
198+
[api_key](../README.md#api_key)
199199

200200
[[Back to top]](#__pageTop) \
201201
[[Back to API list]](../README.md#documentation-for-api-endpoints) \

samples/client/petstore/gdscript/addons/oas.petstore.client/apis/DemoUserApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ api.update_user(
391391

392392
### Authorization
393393

394-
[api_key](../README.md#api_key),
395-
[petstore_auth](../README.md#petstore_auth)
394+
[petstore_auth](../README.md#petstore_auth),
395+
[api_key](../README.md#api_key)
396396

397397
[[Back to top]](#__pageTop) \
398398
[[Back to API list]](../README.md#documentation-for-api-endpoints) \

samples/client/petstore/gdscript/addons/oas.petstore.client/core/DemoApiConfig.gd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ func log_debug(message: String):
130130
print(message)
131131

132132

133+
# Authentication method `petstore_auth`.
134+
# → Skipped: not implemented in the gdscript templates. (contribs welcome)
135+
136+
133137
# Authentication method `api_key`.
134138
# Api Key Authentication `api_key`
135139
func set_security_api_key(value: String):
136140
self.headers_base["api_key"] = value
137141

138142

139-
# Authentication method `petstore_auth`.
140-
# → Skipped: not implemented in the gdscript templates. (contribs welcome)
141-
142-

0 commit comments

Comments
 (0)