Schema in use is for the interesting game SpaceTraders.
wget https://stoplight.io/api/v1/projects/spacetraders/spacetraders/nodes/reference/SpaceTraders.json\?fromExportButton\=true\&snapshotType\=http_service\&deref\=optimizedBundle -O openapi.json
You can see the openAPI in use here.
I had trouble with all the other scala-generators for openAPI and found the smithy4s ecosystem.
mkdir -p generated
smithytranslate openapi-to-smithy --input openapi.json generated
First I got this error, which seems to be caused by a semantic error in the spec. Guess the maximum value is missing. I removed the field and now it works.
All the fixes are in this commit.
Result contained ERROR severity validation events:
[ERROR] openapi#Survey$expiration: Trait `range` cannot be applied to `openapi#Survey$expiration`. This trait may only be applied to shapes that match the following selector: :test(number, member > number) | TraitTarget N/A:0:0
{
"expiration": {
"type": "string",
"format": "date-time",
"description": "The date and time when the survey expires. After this date and time, the survey will no longer be available for extraction.",
"minimum": 0
}
}
mkdir spacetraders-scala
smithy4s generate --output spacetraders-scala generated
Now I get several errors of these types (see smithy4s-generate-errors.log
)
Unable to resolve trait `smithytranslate#errorMessage`
Unable to resolve trait `smithytranslate#contentType`
Other errors came with the @errorMessage
and use smithytranslate#errorMessage
. I just removed them.
All the fixes are in this commit.
Here is a link to my WIP using the generated client.