Fixes 30533: Map AI and context entity types to their schema subdirectories - #30534
Fixes 30533: Map AI and context entity types to their schema subdirectories#30534jun-su-lee wants to merge 3 commits into
Conversation
…tories getEntitySubdirectory() maps an entity type to the subdirectory that holds its JSON schema and falls back to "data". Six entity types were missing from that map, so their schemas were looked up under json/schema/entity/data/ and failed to load. Each one logs an ERROR on every startup and is skipped by field extraction: mcpServer, mcpExecution, aiGovernanceFramework, aiFrameworkControl, auditReport -> json/schema/entity/ai/ contextMemory -> json/schema/entity/context/ Entity types are discovered by scanning json/schema/entity/ with ClassGraph in getAllEntityTypes(), while loading goes through the hardcoded map, so the two can drift. Besides adding the missing entries, this adds a test that walks every discovered entity type and asserts its resolved schema path exists on the classpath, so an entity added under a new subdirectory fails CI instead of silently logging errors at runtime.
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
google-java-format orders non-static imports lexicographically; the new ArrayList import was placed after List, which fails mvn spotless:apply in the java-checkstyle workflow.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
@jun-su-lee Thanks for the detailed report and for digging up the four extra entity types on main that made this quick to confirm. I've addressed it in #30618 with a broader fix: instead of adding entries to the map, it removes the map and resolves each schema's path from the classpath scan that already knows it. That also covers entity types shipped by downstream modules, which a map in this repo can't reach. Your guard test idea carried over. Closing this one in favour of that. Appreciate you catching it |
Code Review ✅ ApprovedMaps missing AI and context entity types to their correct schema subdirectories in SchemaFieldExtractor and adds a test verifying all discovered entity types resolve to existing classpath resources. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
Describe your changes:
Fixes #30533
SchemaFieldExtractor.getEntitySubdirectory()maps an entity type to the subdirectory that holds its JSON schema and falls back to"data". Six entity types are missing from that map, so their schemas are looked up underjson/schema/entity/data/and fail to load — each one logs an ERROR on every server startup and is skipped by field extraction:mcpServerjson/schema/entity/ai/json/schema/entity/data/mcpExecutionjson/schema/entity/ai/json/schema/entity/data/aiGovernanceFrameworkjson/schema/entity/ai/json/schema/entity/data/aiFrameworkControljson/schema/entity/ai/json/schema/entity/data/auditReportjson/schema/entity/ai/json/schema/entity/data/contextMemoryjson/schema/entity/context/json/schema/entity/data/The issue was filed for
mcpServer/mcpExecutionbecause those are the two that exist in 1.13.1; the other four were added after that release and have the same problem onmain.contextMemoryalso lives in a subdirectory (context) that the map does not know about at all.Entity types are discovered by scanning
json/schema/entity/with ClassGraph ingetAllEntityTypes(), while loading goes through the hardcoded map — so the two can drift, and they have drifted six times. Besides adding the missing entries, this PR adds a test that walks every discovered entity type and asserts its resolved schema path exists on the classpath, so an entity added under a new subdirectory fails CI instead of silently logging errors at runtime.Removing the map entirely and reusing the paths that the ClassGraph scan already knows would eliminate this class of bug rather than detect it. I kept that out of this PR to keep the change small — happy to follow up separately if maintainers want it.
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Schema file not found at path: json/schema/entity/data/<entityType>.jsonfor the six entity types aboveGET /api/v1/metadata/types/customProperties) resolves the MCP, AI-governance, audit-report and context-memory entity types instead of skipping themUnit tests
openmetadata-service/src/test/java/org/openmetadata/service/util/SchemaFieldExtractorTest.javaextractFieldsSupportsMcpSchemas()— extracts fields formcpServer/mcpExecutionand asserts the resolved field types, following the existingextractFieldsSupportsLearningAndAiSchemas()test.everyDiscoveredEntityTypeResolvesToAnExistingSchemaResource()— for every entity type returned bygetAllEntityTypes(), resolvesdetermineSchemaPath()and asserts the resource exists on the classpath, reportingentityType -> pathfor any that do not.Verified in both directions on
main:Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
ai/, notdata/:mvn -pl openmetadata-service -am -DskipTests install→ BUILD SUCCESSSchemaFieldExtractorTestwith and without the source change (output above)UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
This PR corrects schema-resource resolution for AI and context entities.
auditReportto theaischema directory.contextMemoryto thecontextschema directory.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/schema-fiel..." | Re-trigger Greptile