Skip to main content

JsonApiResponse

Standard JSON:API response wrapper. Provides a consistent structure for all API responses following the JSON:API specification. Supports both single resources and collections.

Fields

FieldTypeRequiredDefaultDescription
dataForwardRef('Union[JsonApiUseCaseResource, JsonApiUserResource, List[Union[JsonApiUseCaseResource, JsonApiUserResource]]]')PydanticUndefinedPrimary response data
includedForwardRef('Optional[List[JsonApiResourceBase]]')NoneIncluded resources for compound documents
metaForwardRef('Optional[Dict[str, Any]]')NoneNon-standard metadata about the response

Usage Example

from credoai.models import JsonApiResponse

# Create a new instance
model = JsonApiResponse(
data=None, # Primary response data
)

# Convert to dictionary
model_dict = model.model_dump()
print(model_dict)

# Create from dictionary
data = {
"data": None,
}
model_from_dict = JsonApiResponse(**data)

JSON Schema

{
"type": "object",
"title": "JsonApiResponse",
"description": "Standard JSON:API response wrapper.
Provides a consistent structure for all API responses following the
JSON:API specification. Supports both single resources and collections.",
"properties": {
"data": {
"type": "forwardref('union[jsonapiusecaseresource, jsonapiuserresource, list[union[jsonapiusecaseresource, jsonapiuserresource]]]')",
"description": "Primary response data"
},
"included": {
"type": "forwardref('optional[list[jsonapiresourcebase]]')",
"description": "Included resources for compound documents"
},
"meta": {
"type": "forwardref('optional[dict[str, any]]')",
"description": "Non-standard metadata about the response"
}
},
"required": ["data", ]
}