-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[crystal-lang] Various fixes for Crystal client #21045
Conversation
@wing328 I'd like to change this typeMapping.put("object", "Object");
typeMapping.put("AnyType", "Object"); to typeMapping.put("object", "Nil | String | Bool | Int32 | Int64 | Float32 | Float64 | Time");
typeMapping.put("AnyType", "Nil | String | Bool | Int32 | Int64 | Float32 | Float64 | Time"); here: Lines 173 to 174 in 047ceea
because But when I run export _JAVA_OPTIONS=-DmaxYamlCodePoints=99999999 && \
java -jar openapi-generator-cli.jar generate \
-i ./netbox-rest.yml \
-g crystal \
-o ./netbox-client \
--additional-properties moduleName=NetboxClient \
--additional-properties shardName=netbox-client final type is wrongly generated : # @return [Hash(String, NilStringBoolInt32Int64Float32Float64Time)] instead of # @return [Hash(String, Nil | String | Bool | Int32 | Int64 | Float32 | Float64 | Time)] When I run export _JAVA_OPTIONS=-DmaxYamlCodePoints=99999999 && \
java -jar openapi-generator-cli.jar generate \
-i ./netbox-rest.yml \
-g crystal \
-o ./netbox-client \
--additional-properties moduleName=NetboxClient \
--additional-properties shardName=netbox-client \
--type-mappings "Object=Nil | String | Bool | Int32 | Int64 | Float32 | Float64 | Time" it works as expected but I'd prefer to update Java code directly to avoid adding Thank you! |
thanks for the PR i got the following errors when running the integration tests with your branch
and tests passed with the master can you please take a look when you've time? |
@wing328 I think it might come from the Crystal version used to run the tests. Which version of Crystal are you using? |
which version are you using? |
also cc @cyangle (2021/01) |
Crystal 1.15.1 [89944bf17] (2025-02-04)
LLVM: 15.0.7
Default target: aarch64-apple-macosx11.0 |
if you run it with crystal 1.12.x, did you get the same error? just want to rule out it's issue with my local crystal setup. |
yes nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/GITHUB/FORKS/openapi-generator/samples/client/petstore/crystal$ crystal -v
Crystal 1.12.1 [4cea10199] (2024-04-11)
LLVM: 15.0.7
Default target: aarch64-apple-macosx11.0
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/GITHUB/FORKS/openapi-generator/samples/client/petstore/crystal$ shards install
Resolving dependencies
Fetching https://github.com/kemalcr/kemal.git
Fetching https://github.com/crystal-ameba/ameba.git
Fetching https://github.com/mamantoha/crest.git
Fetching https://gitlab.com/arctic-fox/spectator.git
Fetching https://github.com/luislavena/radix.git
Fetching https://github.com/crystal-loot/exception_page.git
Fetching https://github.com/sija/backtracer.cr.git
Fetching https://github.com/mamantoha/http-client-digest_auth.git
Fetching https://github.com/mamantoha/http_proxy.git
Using http-client-digest_auth (0.6.0)
Installing http_proxy (0.13.0)
Installing crest (1.5.1)
Using radix (0.4.1)
Using backtracer (1.2.4)
Using exception_page (0.4.1)
Using kemal (1.5.0)
Using ameba (1.6.4)
Using spectator (0.12.1)
Writing shard.lock
Shard "http_proxy" may be incompatible with Crystal 1.12.1
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/GITHUB/FORKS/openapi-generator/samples/client/petstore/crystal$ crystal spec
Showing last frame. Use --error-trace for full trace.
In lib/http_proxy/src/http/proxy/server.cr:2:1
2 | require "wait_group"
^
Error: can't find file 'wait_group'
If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml? |
@@ -22,7 +22,7 @@ shards: | |||
|
|||
http_proxy: | |||
git: https://github.com/mamantoha/http_proxy.git | |||
version: 0.10.3 | |||
version: 0.13.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use an older version of http_proxy that works with crystal 1.12.x ?
0.13.0 was only released 3 weeks ago
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use an older version of http_proxy that works with crystal 1.12.x ?
Actually the issue comes from crest shard. I've removed the commit that updates crest to v1.5.1. Now it works with Crystal 1.12
all tests passed
|
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)