diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 36f256af..39a578e3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,7 +17,7 @@ on: - "apis/README.md" - "scripts/guards/check_docs_contracts.sh" - "crates/plasm-core/**" - - "fixtures/schemas/plasm_language_matrix/**" + - "fixtures/schemas/**" - ".github/workflows/docs.yml" pull_request: paths: @@ -26,7 +26,7 @@ on: - "apis/README.md" - "scripts/guards/check_docs_contracts.sh" - "crates/plasm-core/**" - - "fixtures/schemas/plasm_language_matrix/**" + - "fixtures/schemas/**" - ".github/workflows/docs.yml" workflow_dispatch: diff --git a/AGENTS.md b/AGENTS.md index 908c68f1..c11f2ab4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,7 +63,7 @@ Durable, non-obvious notes for working in this OSS subtree on a Cursor Cloud VM. - **System deps** (already installed in snapshot, not in the update script): `libssl-dev` + `pkg-config` (`openssl-sys`, pulled by `auth-framework`'s native-tls path) and `protobuf-compiler` (`baml` build script needs `protoc`). - **Generated `baml_client`**: `crates/plasm-eval/baml_client`, `crates/plasm-semantic-seed/baml_client`, and `crates/plasm-discovery-eval/baml_client` are **gitignored** and produced by `baml-cli generate` (v0.220.0) from the repo root. Default **library** builds of `plasm-eval` / `plasm-repl` / `plasm-semantic-seed` do not require them (`baml` / `llm-rerank` are opt-in). **`plasm-server` defaults include `semantic-auto-seed`**, so appliance source builds still need `plasm-semantic-seed/baml_client` unless you pass `--no-default-features`. Re-run `baml-cli generate` after editing anything under `baml_src/`. - **`plasm-trace-sink` (SaaS ops binary)**: durable Iceberg ingest for the execution-trace lane (`PLASM_TRACE_SINK_URL`); not OTEL and not a Cargo dep of the appliance. Often fails to build in this OSS subtree (floating `datafusion_iceberg` vs workspace `datafusion` pin). Build/lint/test with `--exclude plasm-trace-sink`. -- **Some test targets can't compile in this subtree** (they assume the deeper parent-monorepo layout / unexported fixtures): `plasm-core` & `plasm-runtime` lib tests and several `plasm-discovery`/`plasm-e2e` tests `include_str!`/read `../../../fixtures/schemas/*_overlay/`, `pokeapi_mini`, `workflow_matrix` paths that resolve outside `/workspace`; `plasm-agent-core`'s `cross_pod_operations` test overflows the type-layout recursion limit on current rustc. Run the rest with `cargo test --workspace --exclude plasm-trace-sink --exclude plasm-core --exclude plasm-runtime --exclude plasm-agent-core --no-fail-fast` (≈235 pass; network/live tests self-ignore). +- **Schema overlay fixtures** live in this tree at `fixtures/schemas/*_overlay/` (not the parent monorepo). `plasm-core` / `plasm-runtime` lib tests `include_str!` them via `CARGO_MANIFEST_DIR/../../fixtures/schemas/`. `workflow_matrix` still lives only in the private super-repo, so some `plasm-e2e` tests that probe parent paths will skip or fail here. `plasm-agent-core`'s `cross_pod_operations` test overflows the type-layout recursion limit on current rustc. Overlay-free smoke: `cargo test --workspace --exclude plasm-trace-sink --no-fail-fast` (network/live tests self-ignore). - **Lint**: `scripts/ci/rust-quality.sh` runs `cargo fmt --all -- --check` + `cargo clippy --workspace --all-targets -- -D warnings`. Under this OSS subtree/newer clippy it will trip on the items above; `cargo clippy --workspace --exclude plasm-trace-sink` (lib/bins) is clean apart from one newer style lint in `plasm-runtime/src/view_template.rs`. - **Running live queries**: `plasm-cgs` (package `plasm-cli`) does schema validation/round-trips; after BAML generation, the live REPL is `cargo run -p plasm-repl --features baml -- --schema apis/ --backend ` (pipe an expression then `:quit` on stdin for non-interactive use; get-by-id form is `Entity(id)`). Debug builds can **stack-overflow** on large recursive catalogs (e.g. `pokeapi`) because debug stack frames are larger — use a small flat catalog (`xkcd`, backend `https://xkcd.com`) or build `--release` for those. - **Appliance**: `cargo run -p plasm-server -- --no-tui --schema fixtures/schemas/capability_with_input` boots headless, **auto-starts an embedded Postgres** (`pg-embed`), and serves HTTP+MCP on `127.0.0.1:3000` (`/v1/health`, `/v1/registry`, `/execute`). Pass a split catalog directory (`domain.yaml` + `mappings.yaml`) or a packaged plugin dir. diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a286f91..f6678772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ Entries before **0.4.35** live in [`CHANGELOG-ARCHIVE.md`](CHANGELOG-ARCHIVE.md) ## [Unreleased] +### Fixed + +- **In-repo overlay fixtures:** schema-overlay JSON/bootstrap trees now live under + `fixtures/schemas/*_overlay/` so `plasm-core` test compiles (docs CI fenced-example + gate) no longer `include_str!` files from the private parent monorepo. + ## [0.4.45] - 2026-08-10 ### Changed diff --git a/crates/plasm-core/src/schema_overlay.rs b/crates/plasm-core/src/schema_overlay.rs index fe67e0c1..e6d33dd3 100644 --- a/crates/plasm-core/src/schema_overlay.rs +++ b/crates/plasm-core/src/schema_overlay.rs @@ -1154,12 +1154,13 @@ mod tests { #[test] fn build_schema_overlay_from_fixture() { - let json: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" - )) + let json: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" + ))) .expect("fixture JSON"); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/fibery_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/fibery_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); let overlay = build_schema_overlay(spec, &base, &json).expect("build overlay"); @@ -1212,12 +1213,13 @@ mod tests { #[test] fn build_schema_overlay_object_map() { - let json: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/notion_schema_overlay/sample_database_search.json" - )) + let json: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/notion_schema_overlay/sample_database_search.json" + ))) .expect("fixture JSON"); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/notion_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/notion_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); let overlay = build_schema_overlay(spec, &base, &json).expect("build overlay"); @@ -1240,7 +1242,7 @@ mod tests { ] }); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/augment_base_overlay/bootstrap"); + .join("../../fixtures/schemas/augment_base_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); let overlay = build_schema_overlay(spec, &base, &json).expect("build overlay"); @@ -1259,7 +1261,7 @@ mod tests { ] }); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/augment_base_overlay/bootstrap"); + .join("../../fixtures/schemas/augment_base_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); let overlay = build_schema_overlay(spec, &base, &json).expect("build overlay"); @@ -1277,16 +1279,18 @@ mod tests { #[test] fn clickup_multi_step_pipeline_merges_fields_from_fixture_rows() { - let teams: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/clickup_schema_overlay/sample_team_query.json" - )) + let teams: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/clickup_schema_overlay/sample_team_query.json" + ))) .expect("teams JSON"); - let fields_a: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json" - )) + let fields_a: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json" + ))) .expect("fields JSON"); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/clickup_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/clickup_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); base.validate().expect("clickup overlay fixture validates"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); @@ -1315,12 +1319,13 @@ mod tests { #[test] fn clickup_augment_base_fixture_sanitizes_field_names() { - let json: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json" - )) + let json: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json" + ))) .expect("fixture JSON"); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/clickup_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/clickup_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); let overlay = build_schema_overlay(spec, &base, &json).expect("build overlay"); @@ -1337,11 +1342,12 @@ mod tests { #[test] fn cgs_with_overlay_merges_and_validates() { let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/fibery_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/fibery_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); - let json: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" - )) + let json: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" + ))) .expect("fixture JSON"); let spec = base.schema_overlay.as_ref().unwrap(); let overlay = build_schema_overlay(spec, &base, &json).expect("overlay"); @@ -1401,12 +1407,13 @@ mod tests { #[test] fn build_schema_overlay_jira_nested_createmeta() { - let json: JsonValue = serde_json::from_str(include_str!( - "../../../../fixtures/schemas/jira_schema_overlay/sample_createmeta.json" - )) + let json: JsonValue = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/jira_schema_overlay/sample_createmeta.json" + ))) .expect("fixture JSON"); let base_dir = Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/jira_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/jira_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("load bootstrap fixture"); let spec = base.schema_overlay.as_ref().expect("schema_overlay spec"); let overlay = build_schema_overlay(spec, &base, &json).expect("build overlay"); diff --git a/crates/plasm-runtime/src/execution/mod.rs b/crates/plasm-runtime/src/execution/mod.rs index 5460e281..e1b6525d 100644 --- a/crates/plasm-runtime/src/execution/mod.rs +++ b/crates/plasm-runtime/src/execution/mod.rs @@ -4329,11 +4329,12 @@ mod tests { use plasm_core::schema_overlay::build_schema_overlay; let base_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/fibery_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/fibery_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("bootstrap fixture"); - let json: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" - )) + let json: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" + ))) .expect("sample schema JSON"); let spec = base.schema_overlay.as_ref().unwrap(); let overlay = build_schema_overlay(spec, &base, &json).expect("overlay"); @@ -4357,11 +4358,12 @@ mod tests { use plasm_core::schema_overlay::{build_decode_scope_key, build_schema_overlay}; let base_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/fibery_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/fibery_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("bootstrap fixture"); - let json: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" - )) + let json: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" + ))) .expect("sample schema JSON"); let spec = base.schema_overlay.as_ref().unwrap(); let overlay = build_schema_overlay(spec, &base, &json).expect("overlay"); @@ -4393,11 +4395,12 @@ mod tests { use plasm_core::schema_overlay::build_schema_overlay; let base_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("../../../fixtures/schemas/clickup_schema_overlay/bootstrap"); + .join("../../fixtures/schemas/clickup_schema_overlay/bootstrap"); let base = load_schema_dir(&base_dir).expect("bootstrap fixture"); - let json: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json" - )) + let json: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json" + ))) .expect("sample custom field JSON"); let spec = base.schema_overlay.as_ref().unwrap(); let overlay = build_schema_overlay(spec, &base, &json).expect("overlay"); @@ -4427,9 +4430,10 @@ mod tests { plasm_compile::CapabilityTemplate::Http(c) => c, _ => panic!("expected HTTP template"), }; - let json: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" - )) + let json: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_schema_query.json" + ))) .expect("sample schema JSON"); let normalized = prepare_http_query_response(json, cml, &CmlEnv::new()); let decoder = create_entity_decoder_for_capability( @@ -4458,9 +4462,10 @@ mod tests { let cap = cgs.get_capability("user_get_me").expect("user_get_me"); let capability_template = parse_capability_template(&cap.mapping.template).expect("parse template"); - let body: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/fibery_schema_overlay/sample_user_get_me.json" - )) + let body: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_user_get_me.json" + ))) .expect("sample user_get_me JSON"); let narrowed = narrow_http_graphql_response_for_entity_decode(&capability_template, body) .expect("narrow user_get_me"); @@ -4500,9 +4505,10 @@ mod tests { let cap = cgs.get_capability("entity_create").expect("entity_create"); let capability_template = parse_capability_template(&cap.mapping.template).expect("parse template"); - let body: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/fibery_schema_overlay/sample_entity_create.json" - )) + let body: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_entity_create.json" + ))) .expect("sample entity_create JSON"); let narrowed = narrow_http_graphql_response_for_entity_decode(&capability_template, body) .expect("narrow entity_create"); @@ -4644,9 +4650,10 @@ mod tests { plasm_compile::CapabilityTemplate::Http(c) => c, _ => panic!("expected HTTP template"), }; - let body: serde_json::Value = serde_json::from_str(include_str!( - "../../../../../fixtures/schemas/fibery_schema_overlay/sample_view_query.json" - )) + let body: serde_json::Value = serde_json::from_str(include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../fixtures/schemas/fibery_schema_overlay/sample_view_query.json" + ))) .expect("sample view_query JSON"); let normalized = prepare_http_query_response(body, cml, &CmlEnv::new()); let decoder = create_entity_decoder_for_capability( diff --git a/fixtures/schemas/augment_base_overlay/bootstrap/domain.yaml b/fixtures/schemas/augment_base_overlay/bootstrap/domain.yaml new file mode 100644 index 00000000..4edd91be --- /dev/null +++ b/fixtures/schemas/augment_base_overlay/bootstrap/domain.yaml @@ -0,0 +1,74 @@ +version: 1 +http_backend: https://api.clickup.com + +schema_overlay: + source: + capability: custom_field_query + projection: + mode: augment_base + items_path: + - fields + entity: + from_template: Task + name: + template: Task + scope_key: + template: global + dynamic_fields: + from: + kind: array + path: [] + wire_name_path: + - name + wire_type_path: + - type + name: + template: "{{ field.name | sanitize_identifier }}" + type_map: + text: nv_wire_str_short + number: nv_wire_int + default: nv_wire_str_short + extract: + kind: name_value_array + array_path: + - custom_fields + match_key_field: name + match_equals: + template: "{{ field.name }}" + value_field: value + decode: + scope: + params: [] + key: + template: global + capabilities: + - task_get + +entities: + Task: + id_field: id + description: ClickUp task (overlay augments with custom fields). + fields: + id: + required: true + value_ref: nv_wire_str_short + name: + required: false + value_ref: nv_wire_str_short + +capabilities: + custom_field_query: + description: List workspace custom fields. + kind: query + entity: Task + task_get: + description: Get a task. + kind: get + entity: Task + +values: + nv_wire_str_short: + type: string + string_semantics: short + nv_wire_int: + type: integer diff --git a/fixtures/schemas/augment_base_overlay/bootstrap/mappings.yaml b/fixtures/schemas/augment_base_overlay/bootstrap/mappings.yaml new file mode 100644 index 00000000..646d74cb --- /dev/null +++ b/fixtures/schemas/augment_base_overlay/bootstrap/mappings.yaml @@ -0,0 +1,21 @@ +custom_field_query: + method: GET + path: + - type: literal + value: v2 + - type: literal + value: team + - type: var + name: team_id + - type: literal + value: field + +task_get: + method: GET + path: + - type: literal + value: v2 + - type: literal + value: task + - type: var + name: id diff --git a/fixtures/schemas/clickup_schema_overlay/bootstrap/domain.yaml b/fixtures/schemas/clickup_schema_overlay/bootstrap/domain.yaml new file mode 100644 index 00000000..899c0f78 --- /dev/null +++ b/fixtures/schemas/clickup_schema_overlay/bootstrap/domain.yaml @@ -0,0 +1,99 @@ +version: 1 +http_backend: https://api.clickup.com + +schema_overlay: + source: + steps: + - capability: team_query + collect: teams + items_path: + - teams + - capability: custom_field_query + for_each: teams + bind: + team_id: "{{ row.id }}" + merge: + kind: append_array + path: + - fields + projection: + mode: augment_base + items_path: + - fields + entity: + from_template: Task + name: + template: Task + scope_key: + template: global + dynamic_fields: + from: + kind: array + path: [] + wire_name_path: + - name + wire_type_path: + - type + name: + template: "{{ field.name | sanitize_identifier }}" + type_map: + text: nv_wire_str_short + number: nv_wire_int + drop_down: nv_wire_str_short + checkbox: nv_wire_bool + default: nv_wire_str_short + extract: + kind: name_value_array + array_path: + - custom_fields + match_key_field: name + match_equals: + template: "{{ field.name }}" + value_field: value + decode: + scope: + params: [] + key: + template: global + capabilities: + - task_get + +entities: + Task: + id_field: id + description: ClickUp task (overlay augments with custom fields). + fields: + id: + required: true + value_ref: nv_wire_str_short + name: + required: false + value_ref: nv_wire_str_short + +capabilities: + team_query: + description: List authorized teams. + kind: query + entity: Task + custom_field_query: + description: List workspace custom fields. + kind: query + entity: Task + parameters: + - name: team_id + value_ref: nv_wire_str_short + required: true + role: scope + task_get: + description: Get a task. + kind: get + entity: Task + +values: + nv_wire_str_short: + type: string + string_semantics: short + nv_wire_int: + type: integer + nv_wire_bool: + type: boolean diff --git a/fixtures/schemas/clickup_schema_overlay/bootstrap/mappings.yaml b/fixtures/schemas/clickup_schema_overlay/bootstrap/mappings.yaml new file mode 100644 index 00000000..14bc7cde --- /dev/null +++ b/fixtures/schemas/clickup_schema_overlay/bootstrap/mappings.yaml @@ -0,0 +1,31 @@ +team_query: + method: GET + path: + - type: literal + value: v2 + - type: literal + value: team + response: + items: teams + +custom_field_query: + method: GET + path: + - type: literal + value: v2 + - type: literal + value: team + - type: var + name: team_id + - type: literal + value: field + +task_get: + method: GET + path: + - type: literal + value: v2 + - type: literal + value: task + - type: var + name: id diff --git a/fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json b/fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json new file mode 100644 index 00000000..a07dd89c --- /dev/null +++ b/fixtures/schemas/clickup_schema_overlay/sample_custom_field_query.json @@ -0,0 +1,7 @@ +{ + "fields": [ + { "id": "a1", "name": "Priority Level", "type": "drop_down" }, + { "id": "b2", "name": "Story Points", "type": "number" }, + { "id": "c3", "name": "Blocked", "type": "checkbox" } + ] +} diff --git a/fixtures/schemas/clickup_schema_overlay/sample_team_query.json b/fixtures/schemas/clickup_schema_overlay/sample_team_query.json new file mode 100644 index 00000000..bb74bf53 --- /dev/null +++ b/fixtures/schemas/clickup_schema_overlay/sample_team_query.json @@ -0,0 +1,6 @@ +{ + "teams": [ + { "id": "777666555", "name": "Acme Workspace" }, + { "id": "888777666", "name": "Beta Workspace" } + ] +} diff --git a/fixtures/schemas/fibery_schema_overlay/bootstrap/domain.yaml b/fixtures/schemas/fibery_schema_overlay/bootstrap/domain.yaml new file mode 100644 index 00000000..eccf0778 --- /dev/null +++ b/fixtures/schemas/fibery_schema_overlay/bootstrap/domain.yaml @@ -0,0 +1,150 @@ +version: 1 +http_backend: https://example.fibery.io +auth: + scheme: api_key_header + header: Authorization + hosted_kv: plasm:outbound:v1:fixture:fibery_overlay + +schema_overlay: + source: + capability: schema_query + projection: + mode: per_scope_entity + items_path: + - result + - fibery/types + entity: + from_template: Record + name: + template: "{{ row['fibery/name'] | join_sanitize('__', '/') }}" + expression_aliases: + - template: "{{ row['fibery/name'] }}" + scope_key: + template: "{{ row['fibery/name'] }}" + static_fields: + database: + template: "{{ row['fibery/name'] }}" + value_ref: nv_fibery_database_name + dynamic_fields: + from: + kind: array + path: + - fibery/fields + skip: + wire_name_path: + - fibery/name + values_in: + - fibery/id + - fibery/public-id + wire_name_path: + - fibery/name + wire_type_path: + - fibery/type + name: + template: "{{ field['fibery/name'] | sanitize_identifier }}" + type_map: + fibery/text: nv_wire_str_short + fibery/bool: nv_wire_bool + fibery/int: nv_wire_int + fibery/decimal: nv_wire_num + fibery/date-time: nv_wire_date_rfc3339 + fibery/date-range: nv_fibery_payload_json + fibery/uuid: nv_fibery_id + default: nv_fibery_payload_json + extract: + kind: top_level_key + decode: + scope: + params: + - database + key: + template: "{{ ambient.database }}" + capabilities: + - entity_query + - entity_get + +entities: + Record: + id_field: id + key_vars: + - database + - id + description: Generic Fibery database row (overlay adds typed entities per database). + fields: + id: + required: true + value_ref: nv_fibery_id + path: + - fibery/id + public_id: + required: false + value_ref: nv_fibery_public_id + path: + - fibery/public-id + database: + required: true + value_ref: nv_fibery_database_name + payload: + required: false + value_ref: nv_fibery_payload_json + Database: + id_field: qualified_name + description: Fibery database (type) from workspace schema. + fields: + qualified_name: + required: true + value_ref: nv_fibery_database_name + type_id: + required: false + value_ref: nv_fibery_id +capabilities: + schema_query: + description: Fetch workspace schema (fibery.schema/query). + kind: query + entity: Database + entity_query: + description: Query entities in a database. + kind: query + entity: Record + parameters: + - name: database + value_ref: nv_fibery_database_name + required: true + role: scope + entity_get: + description: Get one entity by fibery/id. + kind: get + entity: Record + provides: + - id + - public_id + - database + - payload +values: + nv_fibery_id: + type: string + string_semantics: short + description: Fibery UUID + nv_fibery_public_id: + type: string + string_semantics: short + description: Fibery public id + nv_fibery_database_name: + type: string + string_semantics: short + description: Qualified database name Space/Name + nv_fibery_payload_json: + type: json + description: Unmapped Fibery fields + nv_wire_str_short: + type: string + string_semantics: short + nv_wire_int: + type: integer + nv_wire_num: + type: number + nv_wire_bool: + type: boolean + nv_wire_date_rfc3339: + type: string + value_format: rfc3339 diff --git a/fixtures/schemas/fibery_schema_overlay/bootstrap/mappings.yaml b/fixtures/schemas/fibery_schema_overlay/bootstrap/mappings.yaml new file mode 100644 index 00000000..154c1c29 --- /dev/null +++ b/fixtures/schemas/fibery_schema_overlay/bootstrap/mappings.yaml @@ -0,0 +1,78 @@ +schema_query: + method: POST + path: + - type: literal + value: api + - type: literal + value: commands + body: + type: object + fields: + - - command + - type: const + value: fibery.schema/query + response: + items: result + items_path: + - result + - fibery/types + +entity_query: + method: POST + path: + - type: literal + value: api + - type: literal + value: commands + body: + type: object + fields: + - - command + - type: const + value: fibery.entity/query + - - args + - type: var + name: input + response: + items: result + +entity_get: + method: POST + path: + - type: literal + value: api + - type: literal + value: commands + body: + type: object + fields: + - - command + - type: const + value: fibery.entity/query + - - args + - type: object + fields: + - - query + - type: object + fields: + - - q/from + - type: var + name: database + - - q/select + - type: const + value: ["fibery/id", "fibery/public-id"] + - - q/where + - type: const + value: ["=", ["fibery/id"], "$entity-id"] + - - q/limit + - type: const + value: 1 + - - params + - type: object + fields: + - - $entity-id + - type: var + name: id + response: + items: result + single: true diff --git a/fixtures/schemas/fibery_schema_overlay/sample_entity_create.json b/fixtures/schemas/fibery_schema_overlay/sample_entity_create.json new file mode 100644 index 00000000..ae6cf3c7 --- /dev/null +++ b/fixtures/schemas/fibery_schema_overlay/sample_entity_create.json @@ -0,0 +1,8 @@ +{ + "success": true, + "result": { + "fibery/id": "d17390c4-98c8-11e9-a2a3-2a2ae2dbcce4", + "fibery/public-id": "6", + "Cricket/Name": "Curtly Ambrose" + } +} diff --git a/fixtures/schemas/fibery_schema_overlay/sample_schema_query.json b/fixtures/schemas/fibery_schema_overlay/sample_schema_query.json new file mode 100644 index 00000000..aeef4e8f --- /dev/null +++ b/fixtures/schemas/fibery_schema_overlay/sample_schema_query.json @@ -0,0 +1,39 @@ +{ + "success": true, + "result": { + "fibery/types": [ + { + "fibery/name": "Cricket/Player", + "fibery/id": "2c4213ae-3839-11e9-9162-04d77e8d50cb", + "fibery/fields": [ + { + "fibery/name": "fibery/id", + "fibery/type": "fibery/uuid", + "fibery/meta": { "fibery/readonly?": true } + }, + { + "fibery/name": "fibery/public-id", + "fibery/type": "fibery/text", + "fibery/meta": { "fibery/readonly?": true } + }, + { + "fibery/name": "Cricket/name", + "fibery/type": "fibery/text", + "fibery/meta": {} + }, + { + "fibery/name": "Cricket/Height", + "fibery/type": "fibery/decimal", + "fibery/meta": {} + }, + { + "fibery/name": "Cricket/Retired", + "fibery/type": "fibery/bool", + "fibery/meta": {} + } + ], + "fibery/meta": { "fibery/domain?": true } + } + ] + } +} diff --git a/fixtures/schemas/fibery_schema_overlay/sample_user_get_me.json b/fixtures/schemas/fibery_schema_overlay/sample_user_get_me.json new file mode 100644 index 00000000..bf296cde --- /dev/null +++ b/fixtures/schemas/fibery_schema_overlay/sample_user_get_me.json @@ -0,0 +1,12 @@ +{ + "success": true, + "result": [ + { + "fibery/id": "7dcf4730-82d2-11e9-8a28-82a9c787ee9d", + "user/name": "Arthur Dent", + "user/email": "arthur@example.com", + "user/role": "user", + "user/admin?": false + } + ] +} diff --git a/fixtures/schemas/fibery_schema_overlay/sample_view_query.json b/fixtures/schemas/fibery_schema_overlay/sample_view_query.json new file mode 100644 index 00000000..80e288f2 --- /dev/null +++ b/fixtures/schemas/fibery_schema_overlay/sample_view_query.json @@ -0,0 +1,11 @@ +{ + "jsonrpc": "2.0", + "result": [ + { + "fibery/id": "43addb30-1fd0-11ee-9009-a7c752e861c6", + "fibery/public-id": "45", + "fibery/name": "Supa Doc", + "fibery/type": "document" + } + ] +} diff --git a/fixtures/schemas/jira_schema_overlay/bootstrap/domain.yaml b/fixtures/schemas/jira_schema_overlay/bootstrap/domain.yaml new file mode 100644 index 00000000..9db7b8e6 --- /dev/null +++ b/fixtures/schemas/jira_schema_overlay/bootstrap/domain.yaml @@ -0,0 +1,159 @@ +version: 1 +http_backend: https://example.atlassian.net +auth: + scheme: api_key_header + header: Authorization + env: JIRA_AUTH + +schema_overlay: + source: + steps: + - capability: project_query + collect: projects + items_path: + - values + - capability: issue_createmeta_get + for_each: projects + bind: + id: "{{ row.key }}" + merge: + kind: append_array + path: + - projects + projection: + mode: per_scope_entity + items_path: + - projects + nested_items_path: + - issuetypes + entity: + from_template: Issue + name: + template: "Issue__{{ parent.key | sanitize_identifier }}__{{ row.name | join_sanitize('__', ' ') }}" + scope_key: + template: "{{ parent.key }}:{{ row.name }}" + static_fields: + project_key: + template: "{{ parent.key }}" + value_ref: nv_issue_project_key + issuetype: + template: "{{ row.name }}" + value_ref: nv_wire_str_short + dynamic_fields: + from: + kind: object_map + path: + - fields + skip: + wire_name_path: [] + values_in: + - summary + - description + - issuetype + - project + - reporter + - assignee + - priority + - labels + - attachment + - duedate + - components + - fixVersions + - versions + - environment + - timetracking + - security + - parent + wire_name_path: [] + wire_type_path: + - schema + - type + name: + template: "{{ field_key | sanitize_identifier }}" + type_map: + string: nv_wire_str_short + number: nv_wire_num + array: nv_issue_edit_meta_fields + option: nv_wire_str_short + date: nv_wire_date_rfc3339 + datetime: nv_wire_date_rfc3339 + user: nv_wire_str_short + priority: nv_wire_str_short + status: nv_wire_str_short + issuetype: nv_wire_str_short + project: nv_wire_str_short + default: nv_issue_edit_meta_fields + extract: + kind: path_segments + segments: + - fields + - "{{ field_key }}" + decode: + scope: + params: + - project + - issuetype + key: + template: "{{ ambient.project }}:{{ ambient.issuetype }}" + capabilities: + - issue_createmeta_get + +entities: + Issue: + id_field: key + description: Jira issue (overlay adds per project/issuetype typed entities). + fields: + key: + required: true + value_ref: nv_wire_str_short + summary: + required: false + path: fields.summary + value_ref: nv_wire_str_short + project_key: + required: false + path: fields.project.key + value_ref: nv_issue_project_key + IssueCreateMetaBundle: + id_field: id + domain_projection_examples: false + description: Create form metadata bundle. + fields: + id: + required: true + value_ref: nv_wire_str_short + projects: + required: false + value_ref: nv_issue_edit_meta_fields + +capabilities: + project_query: + description: Search projects. + kind: query + entity: IssueCreateMetaBundle + issue_createmeta_get: + description: Fetch create form field metadata for a project. + kind: get + entity: IssueCreateMetaBundle + parameters: + - name: id + value_ref: nv_issue_project_key + required: true + issue_get: + kind: get + entity: Issue + +values: + nv_issue_project_key: + type: string + string_semantics: short + nv_issue_edit_meta_fields: + type: json + nv_wire_str_short: + type: string + string_semantics: short + nv_wire_num: + type: number + nv_wire_date_rfc3339: + type: date + value_format: rfc3339 diff --git a/fixtures/schemas/jira_schema_overlay/bootstrap/mappings.yaml b/fixtures/schemas/jira_schema_overlay/bootstrap/mappings.yaml new file mode 100644 index 00000000..ba175116 --- /dev/null +++ b/fixtures/schemas/jira_schema_overlay/bootstrap/mappings.yaml @@ -0,0 +1,34 @@ +project_query: + method: GET + path: + - { type: literal, value: rest } + - { type: literal, value: api } + - { type: literal, value: "3" } + - { type: literal, value: project } + - { type: literal, value: search } + response: + items: values + +issue_createmeta_get: + method: GET + path: + - { type: literal, value: rest } + - { type: literal, value: api } + - { type: literal, value: "3" } + - { type: literal, value: issue } + - { type: literal, value: createmeta } + query: + type: object + fields: + - [projectKeys, { type: var, name: id }] + response: single + +issue_get: + method: GET + path: + - { type: literal, value: rest } + - { type: literal, value: api } + - { type: literal, value: "3" } + - { type: literal, value: issue } + - { type: var, name: issueIdOrKey } + response: single diff --git a/fixtures/schemas/jira_schema_overlay/sample_createmeta.json b/fixtures/schemas/jira_schema_overlay/sample_createmeta.json new file mode 100644 index 00000000..a5ee990d --- /dev/null +++ b/fixtures/schemas/jira_schema_overlay/sample_createmeta.json @@ -0,0 +1,30 @@ +{ + "projects": [ + { + "key": "MYPROJ", + "issuetypes": [ + { + "id": "10001", + "name": "Story", + "fields": { + "summary": { + "required": true, + "schema": { "type": "string", "system": "summary" }, + "name": "Summary" + }, + "description": { + "required": false, + "schema": { "type": "string", "system": "description" }, + "name": "Description" + }, + "customfield_10042": { + "required": false, + "schema": { "type": "string", "custom": "com.atlassian.jira.plugin.system.customfieldtypes:textfield" }, + "name": "Epic Link" + } + } + } + ] + } + ] +} diff --git a/fixtures/schemas/jira_schema_overlay/sample_project_query.json b/fixtures/schemas/jira_schema_overlay/sample_project_query.json new file mode 100644 index 00000000..e5a6084d --- /dev/null +++ b/fixtures/schemas/jira_schema_overlay/sample_project_query.json @@ -0,0 +1,7 @@ +{ + "values": [ + { "key": "MYPROJ", "name": "My Project", "id": "10000" } + ], + "total": 1, + "isLast": true +} diff --git a/fixtures/schemas/notion_schema_overlay/bootstrap/domain.yaml b/fixtures/schemas/notion_schema_overlay/bootstrap/domain.yaml new file mode 100644 index 00000000..8ec830c5 --- /dev/null +++ b/fixtures/schemas/notion_schema_overlay/bootstrap/domain.yaml @@ -0,0 +1,134 @@ +version: 1 +http_backend: https://api.notion.com +auth: + scheme: bearer_token + env: NOTION_API_TOKEN + +schema_overlay: + source: + capability: database_search + projection: + mode: per_scope_entity + items_path: + - results + entity: + from_template: Page + name: + template: "{{ row.title[0].plain_text | join_sanitize('__', ' ') }}__{{ row.id | sanitize_identifier }}" + scope_key: + template: "{{ row.id }}" + static_fields: + database_id: + template: "{{ row.id }}" + value_ref: nv_notion_database_id + dynamic_fields: + from: + kind: object_map + path: + - properties + skip: + wire_name_path: [] + values_in: [] + wire_name_path: [] + wire_type_path: + - type + name: + template: "{{ field_key | sanitize_identifier }}" + type_map: + title: nv_wire_str_short + rich_text: nv_wire_str_short + number: nv_wire_num + select: nv_wire_str_short + multi_select: nv_wire_str_short + date: nv_wire_date_rfc3339 + checkbox: nv_wire_bool + url: nv_wire_str_short + email: nv_wire_str_short + phone_number: nv_wire_str_short + default: nv_notion_property_json + extract: + kind: path_segments + segments: + - properties + - "{{ field_key }}" + decode: + scope: + params: + - database_id + key: + template: "{{ ambient.database_id }}" + capabilities: + - database_query + - page_get + +entities: + Page: + id_field: id + description: Notion page / database row (overlay adds per-database typed entities). + fields: + id: + required: true + value_ref: nv_notion_page_id + database_id: + required: false + value_ref: nv_notion_database_id + Database: + id_field: id + description: Notion database container. + fields: + id: + required: true + value_ref: nv_notion_database_id + url: + required: false + value_ref: nv_wire_str_short + +capabilities: + database_search: + description: Search databases shared with the integration. + kind: search + entity: Database + provides: + - id + - url + parameters: + - name: query + value_ref: nv_database_search_query + required: false + role: search + database_query: + description: Query rows in a database. + kind: query + entity: Page + parameters: + - name: database_id + value_ref: nv_notion_database_id + required: true + role: scope + page_get: + description: Get a page by id. + kind: get + entity: Page + +values: + nv_notion_page_id: + type: string + string_semantics: short + nv_notion_database_id: + type: string + string_semantics: short + nv_database_search_query: + type: string + string_semantics: short + nv_notion_property_json: + type: json + nv_wire_str_short: + type: string + string_semantics: short + nv_wire_num: + type: number + nv_wire_bool: + type: boolean + nv_wire_date_rfc3339: + type: string + value_format: rfc3339 diff --git a/fixtures/schemas/notion_schema_overlay/bootstrap/mappings.yaml b/fixtures/schemas/notion_schema_overlay/bootstrap/mappings.yaml new file mode 100644 index 00000000..3cff52af --- /dev/null +++ b/fixtures/schemas/notion_schema_overlay/bootstrap/mappings.yaml @@ -0,0 +1,29 @@ +database_search: + method: POST + path: + - type: literal + value: v1 + - type: literal + value: search + +database_query: + method: POST + path: + - type: literal + value: v1 + - type: literal + value: databases + - type: var + name: database_id + - type: literal + value: query + +page_get: + method: GET + path: + - type: literal + value: v1 + - type: literal + value: pages + - type: var + name: id diff --git a/fixtures/schemas/notion_schema_overlay/sample_database_search.json b/fixtures/schemas/notion_schema_overlay/sample_database_search.json new file mode 100644 index 00000000..754cdf9c --- /dev/null +++ b/fixtures/schemas/notion_schema_overlay/sample_database_search.json @@ -0,0 +1,14 @@ +{ + "results": [ + { + "id": "db-abc123", + "title": [{ "plain_text": "Tasks" }], + "properties": { + "Name": { "type": "title" }, + "Status": { "type": "select" }, + "Due": { "type": "date" }, + "Done": { "type": "checkbox" } + } + } + ] +}