Skip to content
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

Openapi Generator compatibility fixes #156

Closed

Conversation

giordy
Copy link

@giordy giordy commented Dec 1, 2021

The lichess-api.yaml file uses the OpenAPI 3.1 format, which is currently not supported by the OpenAPI Generator.
This means that it is not currently possible to auto-generate an API client in one of the many supported languages to interface to Lichess.

This is quite a pity, because developers can save a lot of time and effort by auto-generating the client code.

Then I recovered the old 3.0 format lichess-api.yaml and adapted it to work well with the OpenAPI Generator. More in details:

  • I fixed some aspects of the spec file that were causing invalid code to be generated. For example, oneOf is not yet supported. It will be support it in the near future.
  • I included the 3.0 spec file in the project, so that it can be used to generate client code.
  • I updated the linter to work only on the most recent 3.1 spec file. NOTE: there's a bug in the linter causing false warnings to be generated
  • I updated the README.md file with some pointers to auto-generate the code.
  • I ported some of the changes in the 3.1 file.

As an example, I include the client code generated for 4 different languages: scala, typescript, java, kotlin:

lichess-client-java.zip
lichess-client-kotlin.zip
lichess-client-scala-play.zip
lichess-client-ts.zip

@giordy giordy force-pushed the openapi-generator-compatibility-fixes branch from 76c4050 to 486b123 Compare December 1, 2021 00:48
@giordy giordy marked this pull request as draft December 2, 2021 21:21
@giordy
Copy link
Author

giordy commented Dec 2, 2021

While this PR focuses in making the code "usable" with the OpenApi Generator, I noticed that few of the endpoints return ndjson and this case is not managed by the auto-generated code.
I guess that for those endpoint the best option is probably to return the data as "string" so that every developer can de-serialize it using some 3rd party library 🤔

@fitztrev
Copy link
Member

Closing for now as the repo structure has changed quite a bit since this PR and this will need to be updated.

Thank you for the initial work and research into getting it set up.

Future PRs with the same goal would be considered.

@fitztrev fitztrev closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants