Skip to content

Commit c6156c4

Browse files
authored
[Core] Store Static examples (#2945)
# Description Store Static raw data example so we can show it in the UI ## Type of change Please leave one option from the following and delete the rest: - [ ] Bug fix (non-breaking change which fixes an issue) - [X] New feature (non-breaking change which adds functionality) - [ ] New Integration (non-breaking change which adds a new integration) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Non-breaking change (fix of existing functionality that will not change current behavior) - [ ] Documentation (added/updated documentation) <h4> All tests should be run against the port production environment(using a testing org). </h4> ### Core testing checklist - [ ] Integration able to create all default resources from scratch - [ ] Resync finishes successfully - [ ] Resync able to create entities - [ ] Resync able to update entities - [ ] Resync able to detect and delete entities - [ ] Scheduled resync able to abort existing resync and start a new one - [ ] Tested with at least 2 integrations from scratch - [ ] Tested with Kafka and Polling event listeners - [ ] Tested deletion of entities that don't pass the selector ### Integration testing checklist - [ ] Integration able to create all default resources from scratch - [ ] Completed a full resync from a freshly installed integration and it completed successfully - [ ] Resync able to create entities - [ ] Resync able to update entities - [ ] Resync able to detect and delete entities - [ ] Resync finishes successfully - [ ] If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the `examples` folder in the integration directory. - [ ] If resource kind is updated, run the integration with the example data and check if the expected result is achieved - [ ] If new resource kind is added or updated, validate that live-events for that resource are working as expected - [ ] Docs PR link [here](#) ### Preflight checklist - [ ] Handled rate limiting - [ ] Handled pagination - [ ] Implemented the code in async - [ ] Support Multi account ## Screenshots Include screenshots from your environment showing how the resources of the integration will look. ## API Documentation Provide links to the API documentation used for this integration.
1 parent b1eaa9a commit c6156c4

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

.github/workflows/release-integrations.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ jobs:
288288
port_app_config_ui_schema_dest="$version_folder/$port_app_config_ui_schema"
289289
port_app_config_ui_schema_latest_dest="$integration_folder/$port_app_config_ui_schema"
290290
291+
static_examples_folder_dest="$integration_folder/examples/"
292+
291293
# Convert YAML to JSON
292294
yq -o json "$file" >"$temp_file"
293295
@@ -330,6 +332,12 @@ jobs:
330332
# Upload global index file to s3
331333
aws s3 cp "$index_file" "s3://$aws_s3_bucket/$index_file"
332334
echo "Successfully uploaded $index_file to s3 bucket."
335+
336+
# Upload Static Examples to s3
337+
if [[ -d "$integration_dir/examples" ]]; then
338+
aws s3 cp "$integration_dir/examples" "s3://$aws_s3_bucket/$static_examples_folder_dest" --recursive
339+
echo "Successfully uploaded $type/examples/ to s3 bucket."
340+
fi
333341
fi
334342
335343
SCHEMA_CLI_COMMANDS=(

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77

88
<!-- towncrier release notes start -->
99

10+
## 0.38.18 (2026-03-16)
11+
12+
### Improvements
13+
14+
- UI schema normalization: single-schema `allOf` is now flattened into the parent object when generating port-app-config UI schema.
15+
- Release workflow: upload integration `.port/examples/` to the registry bucket.
16+
1017
## 0.38.17 (2026-03-16)
1118

1219
### Improvements

port_ocean/cli/commands/port_app_config.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,34 @@ def _load_integration_class(path: str) -> Type[BaseIntegration]:
5050
sys.path.remove(path)
5151

5252

53-
def _dereference_schema(result: dict[str, Any]) -> dict[str, Any]:
54-
"""Dereference all $ref in the UI schema and remove definitions. Uses jsonref."""
53+
def _flatten_single_allof(obj: Any) -> Any:
54+
if isinstance(obj, list):
55+
return [_flatten_single_allof(x) for x in obj]
56+
if not isinstance(obj, dict):
57+
return obj
58+
out = {
59+
k: _flatten_single_allof(v) if isinstance(v, (dict, list)) else v
60+
for k, v in obj.items()
61+
if k != "allOf"
62+
}
63+
allof = obj.get("allOf")
64+
if isinstance(allof, list) and len(allof) == 1 and isinstance(allof[0], dict):
65+
return {**_flatten_single_allof(allof[0]), **out}
66+
if allof is not None:
67+
out["allOf"] = _flatten_single_allof(allof)
68+
return out
69+
70+
71+
def _normalize_schema(result: dict[str, Any]) -> dict[str, Any]:
72+
"""Normalize the UI schema: resolve $refs, drop definitions, flatten single allOf."""
5573
for kind_data in result.get("kinds", {}).values():
5674
selectors = kind_data.get("selectors")
57-
if isinstance(selectors, dict) and "definitions" in selectors:
75+
if not isinstance(selectors, dict):
76+
continue
77+
if "definitions" in selectors:
5878
kind_data["selectors"] = replace_refs(selectors, proxies=False)
5979
kind_data["selectors"].pop("definitions", None)
80+
kind_data["selectors"] = _flatten_single_allof(kind_data["selectors"])
6081
return result
6182

6283

@@ -134,7 +155,7 @@ def port_app_config_schema(
134155
result = config_class.schema()
135156
case "ui":
136157
result = validate_and_get_config_schema(config_class)
137-
result = _dereference_schema(result)
158+
result = _normalize_schema(result)
138159
case _:
139160
click.echo(f"Invalid format: {format}", err=True)
140161
sys.exit(1)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "port-ocean"
3-
version = "0.38.17"
3+
version = "0.38.18"
44
description = "Port Ocean is a CLI tool for managing your Port projects."
55
readme = "README.md"
66
homepage = "https://app.getport.io"

0 commit comments

Comments
 (0)