Skip to content

feat: APIMethod SDK type and OpenAPI Spec loader enhancements#2337

Open
Tony-Atlan wants to merge 9 commits intomainfrom
feat/api-method-loader
Open

feat: APIMethod SDK type and OpenAPI Spec loader enhancements#2337
Tony-Atlan wants to merge 9 commits intomainfrom
feat/api-method-loader

Conversation

@Tony-Atlan
Copy link
Copy Markdown

@Tony-Atlan Tony-Atlan commented Mar 18, 2026

Summary (EPD-268 / PRDLNCH-5559)

Adds the APIMethod Java SDK type and enhances the OpenAPI Spec loader to create APIMethod, APIObject, and APIField entities with full relationship wiring.

Key changes

  • APIMethod SDK type: new entity with relationships to APIPath (parent) and APIObject (request/response schemas)
  • Loader: inline schema support: resolves $ref, inline objects, arrays, and primitives into physical APIObject/APIField hierarchies
  • Loader: example payloads: generateExample() and generatePrimitiveExample() produce JSON example blobs per response body
  • Loader: shell APIObjects: created for primitive and no-content responses so every method has a body entity
  • Loader: relationship fix: method↔object relationships created via POST /api/meta/relationship REST API to work around SDK-Atlas attribute name mismatch (SDK field names are cross-wired relative to Atlas typedef end definitions)
  • Simplified resolveFieldType(): no format suffix; description always set to clear stale values

Commits

  1. 5a43e19 — Add APIMethod, APIObject, APIField creation to OpenAPI Spec loader
  2. 48f6f85 — Add APIMethod Java SDK type with relationships
  3. 265eb89 — Fix compilation errors in APIMethod and APIObject SDK types
  4. da7f171 — Apply Spotless formatting to loader source files
  5. 6011872 — Add inline schema support and expand test coverage
  6. 4b38617 — Apply Spotless formatting to APIMethod SDK files
  7. 123317d — Example payloads, relationship REST API fix, shell objects

Test plan

  • Loader creates APIMethod entities under each APIPath
  • Request/response body APIObjects created per-method (not shared)
  • Relationships visible via Atlas search (apiMethodsRespondingWithThis, apiMethodsRequestingThis)
  • Shell APIObjects created for primitive/no-content responses
  • Example payloads populated on response body blobs
  • Re-run after purging soft-deleted entities produces clean state

🤖 Generated with Claude Code

@Tony-Atlan Tony-Atlan requested a review from cmgrote as a code owner March 18, 2026 05:27
@cmgrote
Copy link
Copy Markdown
Collaborator

cmgrote commented Mar 23, 2026

The only bit that should be direct-managed here is the _overlays/ — everything else needs to go via models repo first.

@Tony-Atlan
Copy link
Copy Markdown
Author

Thanks for the feedback. Understood — the SDK types (IAPIMethod.java, APIMethod.java, and relationship changes to IAPIPath/IAPIObject/APIPath/APIObject) should be generated from the models repo, not hand-written here.

The models PR is up at https://github.com/atlanhq/models/pull/1933 with the APIMethod entity def and 3 relationship defs. Once that's merged and the SDK generator runs, the auto-generated types will replace the hand-written ones in this PR.

For now, the loader code (OpenAPISpecLoader.kt + tests) directly imports com.atlan.model.assets.APIMethod, so removing the SDK files would break compilation. The plan is:

  1. Merge the models PR (Bump dependencies #1933)
  2. Run the SDK generator to produce the official types
  3. Rebase this PR to drop the hand-written SDK files, keeping only _overlays/APIMethod.java + loader code

The _overlays/APIMethod.java (creator method) is the only manually-authored SDK file that should remain.

Tony-Atlan and others added 7 commits April 5, 2026 19:50
Extend the loader to create structured assets from OpenAPI specs:
- APIObject per component schema, with APIField children per property
- APIMethod per HTTP operation (GET/POST/PUT/PATCH/DELETE) per path
- Request/response blobs on APIMethod for display
- Structured relationships to APIObject for field-level search
- apiMethodResponseCodes map for status code → schema mapping
- Nested $ref schemas handled via apiIsObjectReference on APIField

All existing APISpec and APIPath behavior is preserved unchanged
for backward compatibility.

Depends on: APIMethod type in Java SDK (EPD-268, PRDLNCH-5559)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…PIObject

Adds the APIMethod asset type to the Java SDK to support per-HTTP-method
assets as children of APIPath. Includes request/response blob attributes,
structured relationships to APIObject for field-level search, and
back-references on APIPath and APIObject.

New files:
- IAPIMethod.java: interface with field constants and getters
- APIMethod.java: full asset class with all attributes and boilerplate
- _overlays/APIMethod.java: creator convenience methods

Updated files:
- IAPIPath.java / APIPath.java: added apiMethods relationship
- IAPIObject.java / APIObject.java: added apiMethodsRequestingThis and
  apiMethodsRespondingWithThis back-references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The KeywordField constant was missing from the interface, which would
cause compilation errors when tests reference APIMethod.API_METHOD_RESPONSE_CODES.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix Lombok @Singular annotations for apiMethodsRequestingThis and
apiMethodsRespondingWithThis in APIObject.java. Add overrides for
conflicting default methods inherited from IAPI and ICatalog interfaces
in APIMethod.java.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 3: Create synthetic APIObject + APIField assets for inline
request/response schemas that have properties (not just $ref).
Primitive/array inline schemas continue as blob-only.

Phase 5: Add test assertions for response schema relationships
(apiMethodResponseSchemas, apiMethodResponseCodes) and object
reference field linking (apiIsObjectReference, apiObjectQualifiedName).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Expand one-liner method overrides to multi-line format per project
Spotless/Google Java Format rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Tony-Atlan Tony-Atlan force-pushed the feat/api-method-loader branch from d074b83 to 4b38617 Compare April 6, 2026 00:52
- Generate example JSON payloads from OpenAPI schemas instead of raw schema dumps
- Create shell APIObjects for primitive/no-content responses
- Fix method↔object relationships: use REST API instead of broken SDK attribute names
  (SDK sends apiMethodResponseSchemas but Atlas expects apiMethodsRespondingWithThis)
- Add apiPathQualifiedName, apiMethodQualifiedName, apiBodyType to all API entities
- Simplified field type resolution (no format suffix)
- PHYSICAL object creation mode with per-body unique instances

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Tony-Atlan Tony-Atlan changed the title feat: Add APIMethod asset type with request/response schemas feat: APIMethod SDK type and OpenAPI Spec loader enhancements Apr 9, 2026
Add null-safe operator for objectCreationMode to fix CI build failure
when merged with snapshot branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants