GitHub user ABIDHUSSAIN686 edited a discussion: ContentTooLarge Status Code Not
Recognized in Generated Route File Using Guardrail and Pekko
I'm using Guardrail to generate Scala code from an OpenAPI specification. The
generated code is leveraging the
org.apache.pekko.http.scaladsl.model.StatusCodes library, but the status code
**ContentTooLarge** is used, which doesn't exist in the Pekko HTTP model. This
causes the following compilation error:
value ContentTooLarge is not a member of object
org.apache.pekko.http.scaladsl.model.StatusCodes
[error] val status = StatusCodes.ContentTooLarge
Below is my OpenApi.yaml
summary: Create Request
operationId: post-function
tags: [ ]
responses:
'202':
*******************
'400':
*********************
'401':
***************************
description: Create new request
security:
**************
parameters:
- schema:
type: string
in: header
name: x-upstart-tenant
description: UpStart Tenant
required: true
- schema:
type: string
in: header
name: x-upstart-site
description: UpStart Site
required: true
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
filetype:
type: string
enum:
- csv
file:
type: string
format: binary
enum:
- csv
required:
- file
- filetype
description: Pricing Feed CSV or JSON bulk load file
Upon investigating, I found that Pekko doesn't include a **ContentTooLarge**
status code. Instead, **PayloadTooLarge** (413) would be a more appropriate
standard HTTP status code for this scenario.
The **ContentTooLarge** status is generated in the route file by Guardrail.
Since the route file is auto-generated, I cannot directly overwrite or modify
it. This creates a problem when trying to compile the project, as the status
code does not exist in the Pekko HTTP library.
GitHub link: https://github.com/apache/pekko/discussions/1537
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]