pinecone-io / pinecone-java-client

The official Java client for the Pinecone vector database
https://www.pinecone.io
Apache License 2.0
36 stars 13 forks source link

Add codegen script and update generated code for 2024-07 #140

Closed jhamon closed 3 months ago

jhamon commented 4 months ago

Problem

Need to update generated code for the upcoming 2024-07 API release.

Solution

This PR closely follows the approach used in the python and typescript repositories.

The script does the following:

Run the script like this, passing api version number as a positional argument:

./codegen/build-oas.sh 2024-07

Non-generated changes

The updated spec produced slightly different generated code than in the past. In order for the project to compile, I had to make some adjustments:

Type of Change

Test Plan

Code builds and tests pass

jhamon commented 3 months ago

@rohanshah18 You may need to run git submodule init && git submodule update before running the script. This script depends on finding the contents of the apis repo (including the justfile) in a submodule located at codegen/apis but the error message suggests the submodule hasn't been initialized yet. You can check this by seeing what files are inside ls codegen/apis. If it's empty, you have some submodule issue. If you confirm the commands above work, we should probably capture them in a readme or something. Otherwise, more troubleshooting will be needed.

The names of generated objects are a direct consequence of the way things are named and structured in the spec files. A lot of small details shifted in the migration over to the apis repo, but I hope they will be more stable over time. At least the new names are better / shorter in my opinion.

rohanshah18 commented 3 months ago

After @jhamon's latest commit, the script runs successfully with the following commands:

  1. git submodule init && git submodule update
  2. ./codegen/build-oas.sh 2024-07