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

Add API version value to configuration #73

Merged
merged 8 commits into from
Sep 12, 2024

Conversation

raguiar9080
Copy link
Collaborator

@raguiar9080 raguiar9080 commented Aug 15, 2024

Add a new required parameter to the application that specifies the API calendar versions that is to be used. This value is currently added to the configuration of the generated client luneClient.ts so it can be used later. The goal is to have all requests in lune-ts add this value in the Lune-Version header so the library works on a single version, always matching the code with the types in place.

By using a new file `api_versions.txt` that simply contains all the
valid API versions separated by comma, we are able to generate our
client taking into account these versions, allowing a new option on each
endpoint to specify the version and also adding a new method to the
client that allows to set the version for the whole client.1

Signed-off-by: Ruben Aguiar <[email protected]>
@raguiar9080 raguiar9080 requested a review from a team August 15, 2024 15:58
@raguiar9080 raguiar9080 self-assigned this Aug 15, 2024
@raguiar9080 raguiar9080 changed the title Add multiple API versions capabilities Add multiple API versions capability Aug 15, 2024
raguiar9080 added a commit to lune-climate/lune-ts that referenced this pull request Aug 15, 2024
Our new base generator has introduced [^1] capabilities to allow using a
specific API version via the `options` field. This adapts the library to
correctly use this new option.

Keep in mind that there will be more changes introduced when the base
generator is shipped, the dependency here upgraded and everything
regenerated. For now the PR contains the required changes on the actual
library to allow the new field to be used.

[^1]: lune-climate/openapi-typescript-codegen#73

Signed-off-by: Ruben Aguiar <[email protected]>
Reading from a file is clunky and weird. Just add another parameter to
the application.

Signed-off-by: Ruben Aguiar <[email protected]>
Signed-off-by: Ruben Aguiar <[email protected]>
README.md Outdated Show resolved Hide resolved
@rbruggem
Copy link
Member

rbruggem commented Sep 5, 2024

Add a new required parameter to the application that specifies the available API versions. We are then able to generate our client taking into account these versions, allowing a new option on each endpoint to specify the version and also adding a new method to the client that allows to set the version for the client as a whole.

Are you referring to the major version that is part of the path of the date-version in the header?

@raguiar9080
Copy link
Collaborator Author

Add a new required parameter to the application that specifies the available API versions. We are then able to generate our client taking into account these versions, allowing a new option on each endpoint to specify the version and also adding a new method to the client that allows to set the version for the client as a whole.

Are you referring to the major version that is part of the path of the date-version in the header?

No, this refers to the calendar versions provided via header. I'll reword 👍

- Remove `currently` since it adds nothing
- Make sure we always refer to these as calendar versions.

Signed-off-by: Ruben Aguiar <[email protected]>
@raguiar9080
Copy link
Collaborator Author

Everything has been reworded. I'll wait for lune-climate/lune-ts#665 (comment) to be resolved before merging since it will affect necessary changes here.

README.md Outdated Show resolved Hide resolved
docs/basic-usage.md Outdated Show resolved Hide resolved
Copy link
Member

@rbruggem rbruggem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but I think #73 (comment) is important to avoid confusion.

We have decided to not have per-endpoint versions nor client wide
versions. Instead, we will simply have a single version for all the
types that needs to be specified in the request as a header. Rename the
parameter to instead receive a single API Version which is stored in the
`luneClient` configuration, which can be used by `lune-ts` to send via
a header.

Signed-off-by: Ruben Aguiar <[email protected]>
Signed-off-by: Ruben Aguiar <[email protected]>
Signed-off-by: Ruben Aguiar <[email protected]>
@raguiar9080 raguiar9080 changed the title Add multiple API versions capability Add API versions value to configuration Sep 10, 2024
@raguiar9080 raguiar9080 changed the title Add API versions value to configuration Add API version value to configuration Sep 12, 2024
@raguiar9080 raguiar9080 merged commit 31a85ef into master Sep 12, 2024
1 check passed
@raguiar9080 raguiar9080 deleted the ruben/lun-3701-create-api-scaffolding-prototype branch September 12, 2024 09:46
raguiar9080 added a commit to lune-climate/lune-ts that referenced this pull request Sep 12, 2024
Our new base generator has introduced [^1] capabilities that require an
API version to be set which is added in the client configuration. This
version is now fetched and used by the library to pin `lune-ts` to a
specific version of our API using the `Lune-Version` header.

Updating the base generator and regenerating comes with an extra
notice in the file but no other functional changes besides the ones this
PR pretends to introduce.

[^1]: lune-climate/openapi-typescript-codegen#73

Signed-off-by: Ruben Aguiar <[email protected]>
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