Skip to content

Update OpenAPI spec for Python SDK#439

Merged
mgyucht merged 2 commits intomainfrom
update-openapi-spec-14-nov-2023
Nov 14, 2023
Merged

Update OpenAPI spec for Python SDK#439
mgyucht merged 2 commits intomainfrom
update-openapi-spec-14-nov-2023

Conversation

@mgyucht
Copy link
Copy Markdown
Contributor

@mgyucht mgyucht commented Nov 14, 2023

Changes

This PR updates the OpenAPI spec for the Python SDK to d136ad0541f036372601bad9a4382db06c3c912d. As part of this, we add some protection against fields or methods in our spec that conflict with reserved keywords in Python.

Tests

  • make test run locally
  • make fmt applied
  • relevant integration tests applied

@dataclass
class InitScriptEventDetails:
cluster: Optional['List[InitScriptInfoAndExecutionDetails]'] = None
global_: Optional['List[InitScriptInfoAndExecutionDetails]'] = None
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here is the corrected rename of the global field to global_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice


# deduplicate items that may have been added during iteration
seen = set()
query['startIndex'] = 0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mgyucht mgyucht requested a review from tanmay-db November 14, 2023 09:37
@@ -188,10 +188,10 @@ class {{.Name}}API:{{if .Description}}
{{template "method-call" .}}

{{if and .Wait (and (not .IsCrudRead) (not (eq .SnakeName "get_run"))) }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for doing this, LGTM, I have one concern -- this might lead to confusion on when we use .SnakeName and when template "safe-snake-name" .. Should we use safe-snake-name everywhere?

Longer term, I think we will remove this once we will have spec linter and then it would be one time effort to rename these back to .SnakeName

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, you only need to use template "safe-snake-name" . when generating a field or method name. There are places where we check whether the operation is get_run. In that case, it doesn't matter too much, since that is not a reserved keyword.

With this PR in place, there isn't a need for the linter anymore, since we'll safely rename fields that conflict with keywords.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we add .SnakeName where it doesn't work, in theory, it should never pass tests, as these names are never allowed for identifiers of any kind. The developer would then correct the template.

@dataclass
class InitScriptEventDetails:
cluster: Optional['List[InitScriptInfoAndExecutionDetails]'] = None
global_: Optional['List[InitScriptInfoAndExecutionDetails]'] = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice

@mgyucht mgyucht added this pull request to the merge queue Nov 14, 2023
Merged via the queue into main with commit 50c71a1 Nov 14, 2023
@mgyucht mgyucht deleted the update-openapi-spec-14-nov-2023 branch November 14, 2023 10:13
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