Skip to content

feat(gooddata-sdk): [AUTO] Add typed JsonApiParameter entity with NumberParameterDefinition#1576

Open
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C010-20260420-r82171
Open

feat(gooddata-sdk): [AUTO] Add typed JsonApiParameter entity with NumberParameterDefinition#1576
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C010-20260420-r82171

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Implemented SDK wrapper for workspace-scoped parameters (C010). Added CatalogWorkspaceParameter entity model with full CRUD serialization, wired ParametersApi into GoodDataApiClient and CatalogServiceBase, added 4 service methods to CatalogWorkspaceService (list/get/create_or_update/delete), exported the three new classes from the public init.py, and wrote pure-unit tests covering construction, from_api deserialization, and document serialization round-trips.

Impact: new_feature | Services: gooddata-afm-client, gooddata-metadata-client

Files changed

  • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/parameter.py
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/service.py
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/catalog_service_base.py
  • packages/gooddata-sdk/src/gooddata_sdk/client.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/catalog/test_workspace_parameter.py

Agent decisions

Decisions (4)

ParametersApi wiring — Added ParametersApi as a new property on GoodDataApiClient and CatalogServiceBase

  • Alternatives: Import ParametersApi directly in the service method body
  • Why: ParametersApi is not part of the auto-generated EntitiesApi; it requires an explicit property following the same pattern as appearance_api.

from_api key casing — Use snake_case keys (e.g. default_value) when reading from API model objects

  • Alternatives: Use camelCase keys (defaultValue) — incorrect, returns None from .get()
  • Why: ModelNormal deserialized objects store data with snake_case keys in _data_store (convert_js_args_to_python_args converts camelCase → snake_case during deserialization).

_build_attributes key casing — Use camelCase keys (defaultValue) in the dict built for API request bodies

  • Alternatives: Use snake_case — would produce incorrect JSON payloads
  • Why: The generated client sends the dict as-is over the wire; the API expects camelCase JSON property names.

create_or_update strategy — Try GET then PUT (update); catch NotFoundException and fall back to POST (create)

  • Alternatives: Always POST and handle conflict errors
  • Why: Matches the pattern used by create_or_update_workspace (and similar methods throughout the service) where a 404 triggers creation rather than update.
Assumptions to verify (4)
  • The auto-generated ParametersApi.get_all_entities_parameters returns a paged response compatible with load_all_entities (i.e., has .data list and pagination metadata)
  • API model objects returned by ParametersApi use snake_case keys in _data_store, consistent with all other EntitiesApi model objects
  • The pre-existing F821 ruff errors for new_workspace/to_locale in provision_workspace_with_locales are pre-existing and not introduced by this change
  • NumberConstraints min/max fields in _build_attributes are passed as raw numbers and the API accepts them directly
Risks (3)
  • cassette tests for list_workspace_parameters will need real HTTP cassette fixtures since load_all_entities makes paginated API calls
  • from_api assumes snake_case keys from API model internals — if any ParametersApi endpoint returns a model with different key casing this will silently produce None values
  • create_or_update_workspace_parameter catches NotFoundException for the 404 case — if get_workspace_parameter raises a different exception on 404, creation will not be attempted
Layers touched (3)
  • entity_model — New file: CatalogWorkspaceParameterConstraints, CatalogNumberParameterDefinition, CatalogWorkspaceParameter with from_api / as_post_document / as_put_document / as_patch_document
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/parameter.py
  • public_api — Exported 3 new classes; wired ParametersApi into GoodDataApiClient and CatalogServiceBase
    • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
    • packages/gooddata-sdk/src/gooddata_sdk/client.py
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/catalog_service_base.py
  • tests — Pure-unit tests for entity model (no VCR cassettes needed)
    • packages/gooddata-sdk/tests/catalog/test_workspace_parameter.py

Source commits (gdc-nas)

  • 7a10693 Merge pull request #21351 from Vojtasii/vto/sf-pipe
  • c6bbf84 Merge pull request #21680 from Vojtasii/vto/parameters
  • fcad11c Merge pull request #22160 from Vojtasii/vto/parameters-raw-fix
  • 8ce9a88 Merge pull request #22124 from Vojtasii/vto/parameters-include
  • 1d72882 Merge pull request #22090 from Vojtasii/vto/parameters-afm
OpenAPI diff
+      "NumberParameterDefinition": {
+        "properties": {
+          "constraints": { "$ref": "#/components/schemas/NumberConstraints" },
+          "defaultValue": { "format": "double", "type": "number" },
+          "type": { "enum": ["NUMBER"], "type": "string" }
+        },
+        "required": ["defaultValue", "type"]
+      },
+      "JsonApiParameterIn": {
+        "properties": {
+          "attributes": {
+            "properties": {
+              "definition": { "$ref": "#/components/schemas/NumberParameterDefinition" }
+            }
+          },
+          "type": { "enum": ["parameter"] }
+        }
+      },
+    paths:
+      "/api/v1/entities/workspaces/{workspaceId}/parameters": { "get": {...}, "post": {...} }

Workflow run


Generated by SDK OpenAPI Sync workflow

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 86.04651% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.69%. Comparing base (c00ca3b) to head (c63d047).
⚠️ Report is 170 commits behind head on master.

Files with missing lines Patch % Lines
...-sdk/src/gooddata_sdk/catalog/workspace/service.py 25.00% 15 Missing ⚠️
...ta_sdk/catalog/workspace/entity_model/parameter.py 97.02% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1576       +/-   ##
===========================================
+ Coverage    0.00%   78.69%   +78.69%     
===========================================
  Files         158      231       +73     
  Lines       11048    15534     +4486     
===========================================
+ Hits            0    12225    +12225     
+ Misses      11048     3309     -7739     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant