schema-explorer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSchema Explorer
Schema 探索器
OData schema discovery using commands.
dxs schema使用命令进行OData Schema发现。
dxs schemaReferences
参考资料
- references/batch-syntax.md — Batch command syntax, argument styles, describe-entity flags, anti-patterns
- references/subagent-template.md — Subagent delegation prompt
- references/batch-syntax.md — 批量命令语法、参数样式、describe-entity标志、反模式
- references/subagent-template.md — 子代理委托提示
Resolving the Connection
解析连接
Schema commands require a connection ID (). The user may or may not provide one explicitly.
-c <id>If the user provides a connection ID or name — use it directly. Examples: "use connection 9", "use the Prod connection".
If the user says something like "in Prod" or "on the Demo environment" — find the matching FootprintApi connection:
- — get the authenticated organization ID
dxs auth status - — list all connections
dxs organization connection list --org <org_id> - Filter to and match the name
apiConnectionTypeName: FootPrintApi
If the user doesn't specify a connection at all — list the available FootprintApi connections and ask which one to use:
- — get the org ID
dxs auth status - — list connections
dxs organization connection list --org <org_id> - Show the user just the FootprintApi connections (filter out MongoDB, AMQP, SFTP, etc.) and ask them to pick one
Schema命令需要连接ID()。用户可能会明确提供,也可能不会。
-c <id>如果用户提供连接ID或名称 — 直接使用。示例:"使用连接9"、"使用Prod连接"。
如果用户提到类似"在Prod环境"或"在Demo环境" — 查找匹配的FootprintApi连接:
- — 获取已认证的组织ID
dxs auth status - — 列出所有连接
dxs organization connection list --org <org_id> - 筛选并匹配名称
apiConnectionTypeName: FootPrintApi
如果用户完全未指定连接 — 列出可用的FootprintApi连接并询问使用哪一个:
- — 获取组织ID
dxs auth status - — 列出连接
dxs organization connection list --org <org_id> - 仅向用户展示FootprintApi连接(过滤掉MongoDB、AMQP、SFTP等)并让其选择
Input/Output Contract
输入/输出约定
Input: Connection ID + search keywords
Output: file with this structure:
field-mapping.mdmarkdown
undefined输入: 连接ID + 搜索关键词
输出: 结构如下的文件:
field-mapping.mdmarkdown
undefinedSchema: <EntityName>
Schema: <EntityName>
Connection
连接
- Connection ID: <id>
- Namespace: <namespace>
- 连接ID: <id>
- 命名空间: <namespace>
Primary Entity
主实体
- Entity Set: <name>
- Entity Type: <namespace.type>
- Keys: <key fields and types>
- 实体集合: <name>
- 实体类型: <namespace.type>
- 键: <键字段及类型>
Fields
字段
Root Fields
根字段
| Field | Type | Notes |
|---|
| 字段 | 类型 | 说明 |
|---|
Navigation Properties
导航属性
| Nav Property | Target Type | Cardinality | Key Fields |
|---|
| 导航属性 | 目标类型 | 基数 | 键字段 |
|---|
Expanded Fields (via $expand)
扩展字段(通过$expand)
| Path | Type | Source Entity | Binding |
|---|
Mark the Binding column:
- — field is reachable through single navigation properties; safe for flat DataSet fields
flat - — path crosses a collection navigation property (1:N cardinality); requires flow datasource flattening or child dataset with
⚠ collectiondeep path. Will silently render blank if added as a flat DataSet field.CommandText
| 路径 | 类型 | 源实体 | 绑定类型 |
|---|
绑定类型列标记规则:
- — 字段可通过单一导航属性访问;适用于扁平DataSet字段
flat - — 路径跨越集合导航属性(1:N基数);需要流数据源扁平化或使用
⚠ collection深层路径的子数据集。如果作为扁平DataSet字段添加,会静默渲染为空。CommandText
Composite Keys / Special Notes
复合键 / 特殊说明
undefinedundefinedCommand Selection Rule
命令选择规则
Single request → use the direct command. Multiple independent requests → combine into ONE batch.
- If you only need one operation (e.g., one search, one describe), use the direct command — don't wrap it in with a single
dxs schema batch.--request - If you need 2+ independent operations, combine ALL of them into a single call. Don't split independent requests across multiple batch calls — each call is a separate HTTP roundtrip.
dxs schema batch - Only split into a second call when results from the first call determine what to query next.
单一请求 → 使用直接命令。多个独立请求 → 合并为一个批量命令。
- 如果仅需一个操作(如一次搜索、一次描述),使用直接命令 — 不要用单个将其包装在
--request中。dxs schema batch - 如果需要2个及以上独立操作,将所有操作合并到一个调用中。不要将独立请求拆分到多个批量调用中 — 每个调用都是一次单独的HTTP往返。
dxs schema batch - 仅当第一个请求的结果决定后续查询内容时,才拆分到第二个调用。
Workflow
工作流程
-
Search for entities — Combine ALL keyword searches into one batch:bash
dxs schema batch -c <id> \ --request 'search shipment' \ --request 'search order' \ --request 'search warehouse' \ --request 'search carrier'If you can guess entity set names, combine searches with describes in the same batch. Search results include the full qualified(e.g.,entity_type) — save these forDatex.FootPrint.Api.Warehouseflags in later steps.--entity-typeFor a single keyword, use the direct command:.dxs schema search "keyword" -c <id> -
Describe entities and relationships — Combine ALL entity descriptions and relationship exploration into one batch. Useon describe-entity and
--compact --no-udfon relationships:--depth 2bashdxs schema batch -c <id> \ --request 'describe-entity Shipments --compact --no-udf' \ --request 'describe-relationships Shipments --depth 2' \ --request 'describe-entity Orders --compact --no-udf' \ --request 'describe-relationships Orders --depth 2' \ --request 'describe-entity ShipmentLines --compact --no-udf' \ --request 'describe-relationships ShipmentLines --depth 2'Usefor initial exploration. If you need full details on specific fields later, use--compactto describe only those properties.--select Field1,Field2 -
Scan related entity fields — Combine ALL related entity scans into one batch. For each navigation property target you plan to, use
$expand:describe-entity --compact --no-udfbashdxs schema batch -c <id> \ --request 'describe-entity Materials --compact --no-udf' \ --request 'describe-entity Lots --compact --no-udf' \ --request 'describe-entity Addresses --compact --no-udf' \ --request 'describe-entity Contacts --compact --no-udf' \ --request 'describe-entity Warehouses --compact --no-udf' \ --request 'describe-relationships Warehouses --depth 2'Skip entities already covered byin step 2 — depth-2 output includes nested nav property names and target types. Only scan entities where you need the scalar field list fordescribe-relationships --depth 2clauses.$selectWhen you only have the type ID (e.g.,from relationship output) and don't know the entity set name, useDatex.FootPrint.Api.Warehouseinstead — it accepts the full qualified type directly. Useproperties --entity-type Namespace.Typealongside it if you also neednavigation-properties --entity-typepaths.$expandNote: If you needpaths for a related entity (what can be expanded from it), those are in its$expandoutput —navigation_propertiesincludes both scalar properties and nav properties.describe-entity --compact -
Resolve enum values — When a property's type doesn't start with, it's an enum or complex type. Combine all enum lookups into one batch (or use a single direct command if only one):
Edm.bashdxs schema batch -c <id> \ --request 'describe-enum Datex.FootPrint.Api.Statuses' \ --request 'describe-enum Datex.FootPrint.Api.OrderTypes'This tells you what filter values mean (e.g.,→ "Active").StatusId eq 1 -
Verify expansion paths — Invoke theskill to confirm nav properties return data (
odata-execution+$top=1). Some entities have nav properties with NULL foreign keys resulting in empty expansions.$expandWhat to verify:- Deep paths (depth >= 2, e.g., ) — higher failure risk
OrderLine.Material.Description - Paths through nullable foreign keys (e.g., when
ShipToContactis nullable)ShipToContactId - Collection-through-collection expansions (e.g., )
ShipmentLines($expand=OrderLine(...)) - Any path you are not confident about
Safe to skip: Single-level expansions to lookup entities (Status, Type, Category patterns) where the foreign key is non-nullable. These are structurally guaranteed by the schema.Note gaps and suggest alternate query paths (e.g., querying the related entity directly with a filter). Also test lambda operators (/any()) if you need to filter within expanded collections.all() - Deep paths (depth >= 2, e.g.,
-
Build field mapping table — Compile all discovered fields into the field mapping template, separating root fields from navigation properties and expanded fields.Address gaps explicitly. If the user asked about a concept (e.g., "success/failure", "late orders", "priority") and the schema has no direct field for it, say so in the field mapping. Explaining what doesn't exist is as valuable as documenting what does — it saves the user from searching for something that isn't there, and lets them decide on a workaround (derived calculation, external lookup, etc.).
-
搜索实体 — 将所有关键词搜索合并为一个批量命令:bash
dxs schema batch -c <id> \ --request 'search shipment' \ --request 'search order' \ --request 'search warehouse' \ --request 'search carrier'如果能猜到实体集合名称,可在同一个批量命令中结合搜索与描述操作。搜索结果包含完整的限定(如entity_type) — 保存这些内容用于后续步骤中的Datex.FootPrint.Api.Warehouse标志。--entity-type对于单个关键词,使用直接命令:。dxs schema search "keyword" -c <id> -
描述实体与关系 — 将所有实体描述和关系探索合并为一个批量命令。在describe-entity上使用,在relationships上使用
--compact --no-udf:--depth 2bashdxs schema batch -c <id> \ --request 'describe-entity Shipments --compact --no-udf' \ --request 'describe-relationships Shipments --depth 2' \ --request 'describe-entity Orders --compact --no-udf' \ --request 'describe-relationships Orders --depth 2' \ --request 'describe-entity ShipmentLines --compact --no-udf' \ --request 'describe-relationships ShipmentLines --depth 2'初始探索使用。如果之后需要特定字段的完整详情,使用--compact仅描述这些属性。--select Field1,Field2 -
扫描关联实体字段 — 将所有关联实体扫描合并为一个批量命令。对于计划使用的每个导航属性目标,使用
$expand:describe-entity --compact --no-udfbashdxs schema batch -c <id> \ --request 'describe-entity Materials --compact --no-udf' \ --request 'describe-entity Lots --compact --no-udf' \ --request 'describe-entity Addresses --compact --no-udf' \ --request 'describe-entity Contacts --compact --no-udf' \ --request 'describe-entity Warehouses --compact --no-udf' \ --request 'describe-relationships Warehouses --depth 2'跳过步骤2中已覆盖的实体 — 深度为2的输出包含嵌套导航属性名称和目标类型。仅扫描需要标量字段列表用于describe-relationships --depth 2子句的实体。$select当仅拥有类型ID(如关系输出中的)且不知道实体集合名称时,改用Datex.FootPrint.Api.Warehouse— 它直接接受完整的限定类型。如果还需要properties --entity-type Namespace.Type路径,可同时使用$expand。navigation-properties --entity-type注意: 如果需要关联实体的路径(从该实体可扩展的内容),这些信息在其$expand输出中 —navigation_properties同时包含标量属性和导航属性。describe-entity --compact -
解析枚举值 — 当属性类型不以开头时,它是枚举或复杂类型。将所有枚举查询合并为一个批量命令(如果仅需查询一个,使用单个直接命令):
Edm.bashdxs schema batch -c <id> \ --request 'describe-enum Datex.FootPrint.Api.Statuses' \ --request 'describe-enum Datex.FootPrint.Api.OrderTypes'这会告知你筛选值的含义(如→ "Active")。StatusId eq 1 -
验证扩展路径 — 调用技能确认导航属性返回数据(
odata-execution+$top=1)。部分实体的导航属性可能存在NULL外键,导致扩展结果为空。$expand需要验证的场景:- 深层路径(深度≥2,如) — 失败风险更高
OrderLine.Material.Description - 可为空外键的路径(如为空时的
ShipToContactId)ShipToContact - 集合到集合的扩展(如)
ShipmentLines($expand=OrderLine(...)) - 任何你不确定的路径
可安全跳过的场景: 外键不可为空的单级扩展到查询实体(Status、Type、Category模式)。这些在结构上由Schema保证。记录缺口并建议替代查询路径(如直接查询关联实体并添加筛选条件)。如果需要在扩展集合内筛选,也测试lambda运算符(/any())。all() - 深层路径(深度≥2,如
-
构建字段映射表 — 将所有发现的字段整理到字段映射模板中,区分根字段、导航属性和扩展字段。明确说明缺口。 如果用户询问某个概念(如"成功/失败"、"延迟订单"、"优先级")但Schema中没有对应字段,需在字段映射中说明。解释不存在的内容与记录存在的内容同样重要 — 这能避免用户寻找不存在的内容,并让他们决定解决方案(派生计算、外部查询等)。
Subagent Usage
子代理使用
Schema exploration can generate significant output. Delegate to a subagent to keep the main context clean. See references/subagent-template.md for the prompt template.
Write output to the artifact directory:
- — raw schema discovery output
01-schema-exploration.md - — completed field mapping table
02-field-mapping.md
Schema探索会生成大量输出。可委托给子代理以保持主上下文整洁。提示模板请参见references/subagent-template.md。
将输出写入工件目录:
- — 原始Schema发现输出
01-schema-exploration.md - — 已完成的字段映射表
02-field-mapping.md
describe-entity Flags
describe-entity标志
describe-entity--concise--compact--no-udf-P-N--prop-top--select--request 'describe-entity Orders --compact --no-udf'describe-entity--concise--compact--no-udf-P-N--prop-top--select--request 'describe-entity Orders --compact --no-udf'Additional Rules
额外规则
Rules already embedded in the workflow steps above are not repeated here. See references/batch-syntax.md for the full anti-patterns table.
- Always check the section — some entities have composite keys (no
keys:field)Id - takes one property name at a time — not comma-separated; for bulk discovery use
describe-propertiesor batch multiple callsdescribe-entity --compact --no-udf - Batch eliminates the "run sequentially" constraint — unlike parallel tool calls (which abort siblings on failure), batch handles individual request failures gracefully
已嵌入工作流程步骤中的规则不再重复。完整的反模式表请参见references/batch-syntax.md。
- 始终检查部分 — 部分实体拥有复合键(无
keys:字段)Id - 一次仅接受一个属性名称 — 不支持逗号分隔;批量发现请使用
describe-properties或批量调用多个命令describe-entity --compact --no-udf - 批量命令消除了"顺序执行"的限制 — 与并行工具调用(某个调用失败会终止其他调用)不同,批量命令能优雅处理单个请求失败的情况