Closed jhamon closed 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.
After @jhamon's latest commit, the script runs successfully with the following commands:
git submodule init && git submodule update
./codegen/build-oas.sh 2024-07
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.
codegen
directory to act as the home for everything codegen related. Inside this directory there are several things:build-oas.sh
script which does everything to generate the code off the specThe script does the following:
src/
Run the script like this, passing api version number as a positional argument:
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:
IndexModel
class instead of a standalone metric object, requiring a small refactor along the lines ofIndexMetric.COSINE.toString()
toIndexModel.MetricEnum.COSINE.toString()
and similar for other metric types.IndexSpec
instead ofCreateInexRequestSpec
.PodSpec
instead ofCreateIndexRequestSpecPod
PodSpecMetadataConfig
instead ofCreateIndexRequestSpecPodMetadataConfig
Type of Change
Test Plan
Code builds and tests pass