Add Pydantic response models for OpenAPI/Swagger docs#10
Open
HaraldeRoessler wants to merge 1 commit intoMoltyCel:mainfrom
Open
Add Pydantic response models for OpenAPI/Swagger docs#10HaraldeRoessler wants to merge 1 commit intoMoltyCel:mainfrom
HaraldeRoessler wants to merge 1 commit intoMoltyCel:mainfrom
Conversation
The OpenAPI/Swagger docs show empty response schemas for all endpoints
because no response_model is set on the FastAPI route decorators.
Adds response models for:
- GET /identity/verify/{did} -> VerifyResponse
- GET /reputation/query/{did} -> ReputationResponse
- GET /skill/trust-score/{did} -> TrustScoreResponse
- GET /identity/resolve/{did} -> DIDDocumentResponse
- GET /health -> HealthResponse
- POST /reputation/rate -> RateResponse
Discovered while debugging moltrust-openclaw plugin showing undefined
(see MoltyCel/moltrust-openclaw#1).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Swagger docs at /docs show empty response schemas (
{}) for all endpoints because noresponse_modelis set on the FastAPI route decorators. This makes it impossible for plugin/SDK developers to know what fields the API returns.The problem
All three sources tell a different story:
/identity/verify/{did}{did, verified, reputation}{}{did, verified, message, trustScore}/skill/trust-score/{did}{did, trust_score, grade, breakdown, ...}{}{did, score, grade, sybilRisk}/reputation/query/{did}{did, score, total_ratings}{}This caused the moltrust-openclaw plugin to show 'undefined' — fixed in MoltyCel/moltrust-openclaw#1.
Changes
Adds Pydantic response models for 6 core endpoints:
VerifyResponsefor GET /identity/verify/{did}ReputationResponsefor GET /reputation/query/{did}TrustScoreResponse+TrustScoreBreakdownfor GET /skill/trust-score/{did}DIDDocumentResponse+DIDDocumentMetadatafor GET /identity/resolve/{did}HealthResponsefor GET /healthRateResponsefor POST /reputation/rateTest plan
Generated with Claude Code