You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the conversation, the user is attempting to express an API endpoint using the HttpApi module, which returns a PDF as a base64 string. The user provides an OpenAPI specification and shares their current TypeScript implementation using the HttpApi module. However, the current implementation lacks certain details, such as base64 encoding and response headers.
Base64 Encoding:
To handle the base64 encoding, you can set a jsonSchema annotation on a Schema, marking the string as a base64 format. This is done by creating a Base64String schema with the appropriate JSON schema descriptor ("format": "base64").
Response Headers:
There is no current method in the HttpApi module to define response headers directly within the TypeScript implementation shared in this conversation.
Content Type Issue:
The specification of contentType: "application/pdf" seems to be ignored when using the HttpApiSchema.withEncoding.
The key takeaways are:
You can specify custom formats and JSON schema annotations in the HttpApi module using codecs in Effect TypeScript.
The current version of the HttpApi module may not support expressing response headers, and there could be limitations in specifying certain content types directly.
Summary
In the conversation, the user is attempting to express an API endpoint using the HttpApi module, which returns a PDF as a base64 string. The user provides an OpenAPI specification and shares their current TypeScript implementation using the HttpApi module. However, the current implementation lacks certain details, such as base64 encoding and response headers.
Base64 Encoding:
jsonSchema
annotation on aSchema
, marking the string as a base64 format. This is done by creating aBase64String
schema with the appropriate JSON schema descriptor ("format": "base64"
).Response Headers:
Content Type Issue:
contentType: "application/pdf"
seems to be ignored when using theHttpApiSchema.withEncoding
.The key takeaways are:
Discord thread
https://discord.com/channels/795981131316985866/1326480481637896242
The text was updated successfully, but these errors were encountered: