mikebridge opened a new pull request, #45107: URL: https://github.com/apache/superset/pull/45107
### SUMMARY `POST /api/v1/semantic_layer/schema/configuration` returns the JSON Schema for a semantic layer type's configuration form. When the request includes a partial `configuration`, the endpoint parses it and passes it to the provider's `get_configuration_schema`. Some providers use it to call the configured service and fill in choices, for example the available accounts, projects or environments. That enrichment is part of configuring a layer, so it now requires `can_write` on `SemanticLayer`: - **Callers with `can_write`:** unchanged. The submitted configuration is parsed and passed to the provider, and they get the enriched schema. - **Read-only callers (`can_read` only):** they get the static schema, `get_configuration_schema(None)`. The submitted configuration is neither parsed nor passed to the provider. The endpoint keeps its `read` permission, so read-only users can still load the static form. The response shape is unchanged. The only UI caller is the semantic layer create/edit modal, which already needs write access to save. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A (no UI change for users who can create or edit semantic layers). ### TESTING INSTRUCTIONS Unit tests: ```bash pytest tests/unit_tests/semantic_layers/api_test.py -k configuration_schema ``` - `test_configuration_schema_read_only_user_gets_static_schema`: without `can_write`, the provider gets `None` and the configuration is not parsed. - `test_configuration_schema_writer_gets_enriched_schema`: with `can_write`, the parsed configuration reaches the provider. - The existing enrichment tests now grant `can_write` explicitly instead of relying on the test fixture. Manual check, with `SEMANTIC_LAYERS` enabled: 1. As an admin, open **+ Semantic layer**, choose a provider that enriches its form, and fill in the connection fields. The dependent dropdowns populate as before. 2. As a user with `can_read` but not `can_write` on `SemanticLayer`, `POST` the same body to `/api/v1/semantic_layer/schema/configuration`. The response is the static schema. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: `SEMANTIC_LAYERS` - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
