Skip to content

Comments

Upgrades the oapi-generate package#1832

Merged
schnie merged 3 commits intopolaris-mainfrom
fix/oapi-generate
Apr 15, 2025
Merged

Upgrades the oapi-generate package#1832
schnie merged 3 commits intopolaris-mainfrom
fix/oapi-generate

Conversation

@schnie
Copy link
Member

@schnie schnie commented Apr 14, 2025

Description

We are planning to add new CLI commands that interact with brand new API endpoints for Polaris. I attempted to update our generated clients with make generate, but ran in the issue shown below. After digging in, it was discovered that this package has been updated and re-located. I've updated deepmap/oapi-generate to oapi-generate/oapi-generate and it appears to have resolved the issue. It required some minor code updates, but seems to have worked.

Fixes this issue:

make generate
go generate -x
go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --version
go: downloading github.com/getkin/kin-openapi v0.128.0
go: downloading github.com/invopop/yaml v0.3.1
# github.com/deepmap/oapi-codegen/pkg/util
../../../../pkg/mod/github.com/deepmap/[email protected]/pkg/util/loader.go:24:45: undefined: openapi3.CircularReferenceCounter
../../../../pkg/mod/github.com/deepmap/[email protected]/pkg/util/loader.go:26:12: undefined: openapi3.CircularReferenceCounter
../../../../pkg/mod/github.com/deepmap/[email protected]/pkg/util/loader.go:33:12: undefined: openapi3.CircularReferenceCounter
main.go:12: running "go": exit status 1
make: *** [generate] Error 1

🎟 Issue(s)

Pre-work for https://github.com/astronomer/astro/issues/29258

🧪 Functional Testing

List the functional testing steps to confirm this feature or fix.

📸 Screenshots

Add screenshots to illustrate the validity of these changes.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@schnie schnie marked this pull request as ready for review April 14, 2025 17:48
@schnie schnie changed the title Gets oapi-generate working again Upgrade oapi-generate package to new location Apr 14, 2025
@schnie schnie changed the title Upgrade oapi-generate package to new location Upgrades the oapi-generate package Apr 14, 2025

func ListConnections(workspaceID, deploymentID string, coreClient astrocore.CoreClient) (map[string]astrocore.EnvironmentObjectConnection, error) {
envObjs, err := listEnvironmentObjects(workspaceID, deploymentID, astrocore.ListEnvironmentObjectsParamsObjectTypeCONNECTION, coreClient)
envObjs, err := listEnvironmentObjects(workspaceID, deploymentID, astrocore.CONNECTION, coreClient)
Copy link
Member Author

Choose a reason for hiding this comment

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

I guess the format of constant/enums was changed. Seems like the only actual code change needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Losing that prefix is unfortunate, is there no option to get it back? Seems like without the prefix it would be harder to list available values for a field, and they could clash across fields.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea this is weird, I don't know why only this one is affected. The other ones around it seem the same -

// Defines values for ListEnvironmentObjectsParamsObjectType.
const (
AIRFLOWVARIABLE ListEnvironmentObjectsParamsObjectType = "AIRFLOW_VARIABLE"
CONNECTION ListEnvironmentObjectsParamsObjectType = "CONNECTION"
METRICSEXPORT ListEnvironmentObjectsParamsObjectType = "METRICS_EXPORT"
)

@schnie schnie changed the base branch from main to polaris-main April 15, 2025 15:27
@schnie schnie merged commit b95f7d6 into polaris-main Apr 15, 2025
5 checks passed
@schnie schnie deleted the fix/oapi-generate branch April 15, 2025 15:32
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