-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I was trying to create a small program to interact with the nookipedia api. (https://api.nookipedia.com/doc)
I downloaded the nookipedia api specification from the website, converted the yaml to json with python3
Running the tool on the json, gives the following output
$ curl -L 'https://api.nookipedia.com/static/doc.yaml' -o nook.yml
$ python3 -c 'import json; import sys; import yaml; y=yaml.safe_load(sys.stdin.read()) ; json.dump(y, sys.stdout, indent=4);' < nook.yml > nook.json
$ dub run openapi-client -- --targetDir=source --openApiSpec=nook.json --packageRoot=nook
Building package openapi-client in /home/user/.dub/packages/openapi-client/2.1.0/openapi-client/
Pre-gen Running commands for openssl
Starting Performing "debug" build using /data/home/user/dlang/dmd-2.105.0/linux/bin64/dmd for x86_64.
Up-to-date builder 0.2.1: target for configuration [library] is up to date.
Up-to-date stdx-allocator 2.77.5: target for configuration [library] is up to date.
Up-to-date vibe-d:utils 0.9.6: target for configuration [library] is up to date.
Up-to-date vibe-d:data 0.9.6: target for configuration [library] is up to date.
Up-to-date diet-ng 1.8.1: target for configuration [library] is up to date.
Up-to-date mir-linux-kernel 1.0.1: target for configuration [library] is up to date.
Up-to-date taggedalgebraic 0.11.22: target for configuration [library] is up to date.
Up-to-date eventcore 0.9.25: target for configuration [epoll] is up to date.
Up-to-date vibe-core 2.2.0: target for configuration [epoll] is up to date.
Up-to-date vibe-d:crypto 0.9.6: target for configuration [library] is up to date.
Up-to-date vibe-d:stream 0.9.6: target for configuration [library] is up to date.
Up-to-date vibe-d:textfilter 0.9.6: target for configuration [library] is up to date.
Up-to-date vibe-d:inet 0.9.6: target for configuration [library] is up to date.
Up-to-date vibe-d:tls 0.9.6: target for configuration [openssl] is up to date.
Up-to-date vibe-d:http 0.9.6: target for configuration [library] is up to date.
Up-to-date openapi-client 2.1.0: target for configuration [application] is up to date.
Finished To force a rebuild of up-to-date targets, run again with --force
Running ../../../../home/user/.dub/packages/openapi-client/2.1.0/openapi-client/target/openapi-client --targetDir=source --openApiSpec=nook.json --packageRoot=nook
Added reference: #/components/schemas/NHBug
Warning: South may have additional properties!
Warning: AvailabilityArray may have additional properties!
Warning: TimesByMonth may have additional properties!
Warning: North may have additional properties!
Warning: AvailabilityArray may have additional properties!
Warning: TimesByMonth may have additional properties!
Writing file: source/nook/model/NHBug.d
Added reference: #/components/schemas/NHEvent
Writing file: source/nook/model/NHEvent.d
Added reference: #/components/schemas/NHArtwork
Warning: FakeInfo may have additional properties!
Warning: RealInfo may have additional properties!
Writing file: source/nook/model/NHArtwork.d
Added reference: #/components/schemas/NHItem
Warning: Availability may have additional properties!
Warning: Buy may have additional properties!
Writing file: source/nook/model/NHItem.d
Added reference: #/components/schemas/NHPhoto
Warning: Availability may have additional properties!
Warning: Variations may have additional properties!
Warning: Buy may have additional properties!
Writing file: source/nook/model/NHPhoto.d
Added reference: #/components/schemas/NHInterior
Warning: Availability may have additional properties!
Warning: Buy may have additional properties!
Writing file: source/nook/model/NHInterior.d
Added reference: #/components/schemas/Error401
Writing file: source/nook/model/Error401.d
Added reference: #/components/schemas/NHRecipe
Warning: Availability may have additional properties!
Warning: Materials may have additional properties!
Warning: Buy may have additional properties!
Writing file: source/nook/model/NHRecipe.d
Added reference: #/components/schemas/NHFossilGroup
Writing file: source/nook/model/NHFossilGroup.d
Added reference: #/components/schemas/NHFurniture
Warning: Availability may have additional properties!
Warning: Buy may have additional properties!
Warning: Variations may have additional properties!
Writing file: source/nook/model/NHFurniture.d
Added reference: #/components/schemas/NHTool
Warning: Availability may have additional properties!
Warning: Variations may have additional properties!
Warning: Buy may have additional properties!
Writing file: source/nook/model/NHTool.d
Added reference: #/components/schemas/NHSeaCreature
Warning: South may have additional properties!
Warning: AvailabilityArray may have additional properties!
Warning: TimesByMonth may have additional properties!
Warning: North may have additional properties!
Warning: AvailabilityArray may have additional properties!
Warning: TimesByMonth may have additional properties!
Writing file: source/nook/model/NHSeaCreature.d
Added reference: #/components/schemas/Villager
Warning: NhDetails may have additional properties!
Writing file: source/nook/model/Villager.d
Added reference: #/components/schemas/Error404
Writing file: source/nook/model/Error404.d
Added reference: #/components/schemas/NHFossilGroupWithIndividualFossilsNoMatched
Warning: Fossils may have additional properties!
Writing file: source/nook/model/NHFossilGroupWithIndividualFossilsNoMatched.d
Added reference: #/components/schemas/Error400
Writing file: source/nook/model/Error400.d
Added reference: #/components/schemas/Error500
Writing file: source/nook/model/Error500.d
Added reference: #/components/schemas/NHFossilGroupWithIndividualFossils
Warning: Fossils may have additional properties!
Warning: Matched may have additional properties!
Writing file: source/nook/model/NHFossilGroupWithIndividualFossils.d
Added reference: #/components/schemas/NHFish
Warning: South may have additional properties!
Warning: AvailabilityArray may have additional properties!
Warning: TimesByMonth may have additional properties!
Warning: North may have additional properties!
Warning: AvailabilityArray may have additional properties!
Warning: TimesByMonth may have additional properties!
Writing file: source/nook/model/NHFish.d
Added reference: #/components/schemas/NHIndividualFossil
Writing file: source/nook/model/NHIndividualFossil.d
Added reference: #/components/schemas/NHClothing
Warning: Availability may have additional properties!
Warning: Variations may have additional properties!
Warning: Buy may have additional properties!
Writing file: source/nook/model/NHClothing.d
Adding path: /nh/photos
PathRoot: /nh/photos
Adding path: /nh/art/{artwork}
PathRoot: /nh/art
Adding path: /nh/fossils/groups
PathRoot: /nh/fossils/groups
Adding path: /nh/sea/{sea_creature}
PathRoot: /nh/sea
Adding path: /nh/fish/{fish}
PathRoot: /nh/fish
Adding path: /nh/clothing/{clothing}
PathRoot: /nh/clothing
Adding path: /nh/furniture/{furniture}
PathRoot: /nh/furniture
Adding path: /nh/interior
PathRoot: /nh/interior
Adding path: /nh/events
PathRoot: /nh/events
Adding path: /nh/fossils/all/{fossil}
PathRoot: /nh/fossils/all
Adding path: /nh/bugs/{bug}
PathRoot: /nh/bugs
Adding path: /nh/art
PathRoot: /nh/art
Adding path: /nh/photos/{item}
PathRoot: /nh/photos
Adding path: /nh/fossils/individuals
PathRoot: /nh/fossils/individuals
Adding path: /nh/items/{item}
PathRoot: /nh/items
Adding path: /nh/fossils/groups/{fossil_group}
PathRoot: /nh/fossils/groups
Adding path: /nh/tools
PathRoot: /nh/tools
Adding path: /nh/fossils/individuals/{fossil}
PathRoot: /nh/fossils/individuals
Adding path: /nh/bugs
PathRoot: /nh/bugs
Adding path: /nh/tools/{tool}
PathRoot: /nh/tools
Adding path: /nh/fossils/all
PathRoot: /nh/fossils/all
Adding path: /nh/sea
PathRoot: /nh/sea
Adding path: /nh/fish
PathRoot: /nh/fish
Adding path: /nh/recipes/{item}
PathRoot: /nh/recipes
Adding path: /nh/clothing
PathRoot: /nh/clothing
Adding path: /nh/furniture
PathRoot: /nh/furniture
Adding path: /nh/interior/{item}
PathRoot: /nh/interior
Adding path: /villagers
PathRoot: /villagers
Adding path: /nh/recipes
PathRoot: /nh/recipes
Adding path: /nh/items
PathRoot: /nh/items
Generating service for /nh/furniture with 2 path items.
- Generating methods for /nh/furniture/{furniture}
core.exception.ArrayIndexError@/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/openapi_client/util.d(127): index [0] is out of bounds for array of length 0
----------------
??:? onArrayIndexError [0x55e80742ab9a]
??:? _d_arraybounds_indexp [0x55e8073c81ff]
/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/openapi_client/util.d:127 immutable(char)[] openapi_client.util.toCamelCase(immutable(char)[], bool) [0x55e80726d4b8]
/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/openapi_client/util.d:110 immutable(char)[] openapi_client.util.toLowerCamelCase(immutable(char)[]) [0x55e80726d466]
/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/openapi_client/paths.d:200 void openapi_client.paths.generatePathItemMethods(std.array.Appender!(immutable(char)[]).Appender, immutable(char)[], openapi.OasPathItem, immutable(char)[]) [0x55e8072404da]
/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/openapi_client/paths.d:59 int openapi_client.paths.writePathFiles(openapi.OasDocument, immutable(char)[], immutable(char)[]).__foreachbody6(ref immutable(char)[], ref openapi_client.paths.PathEntry[]) [0x55e80723f5b8]
??:? _aaApply2 [0x55e8073d47f8]
/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/openapi_client/paths.d:45 void openapi_client.paths.writePathFiles(openapi.OasDocument, immutable(char)[], immutable(char)[]) [0x55e80723ef1d]
/home/user/.dub/packages/openapi-client/2.1.0/openapi-client/source/main.d:36 _Dmain [0x55e8071c35d8]
Error Program exited with code 1
The error appears to be caused by openapi_client.util.toCamelCase not checking for empty strings before indexing the first character.
Not sure if this is a problem with this specific api file or something with the python tool messed up the spec file.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels