You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "ABIDHUSSAIN686 (via GitHub)" <gi...@apache.org> on 2024/10/20 13:16:43 UTC

[D] ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko [pekko]

GitHub user ABIDHUSSAIN686 created 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 notifications@pekko.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@pekko.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [D] ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko [pekko]

Posted by "ABIDHUSSAIN686 (via GitHub)" <gi...@apache.org>.
GitHub user ABIDHUSSAIN686 added a comment to the discussion: ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko

Right, I was using version 1.0.1, and version 1.1.0 worked for me. Thanks.

GitHub link: https://github.com/apache/pekko/discussions/1537#discussioncomment-11001295

----
This is an automatically sent email for notifications@pekko.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@pekko.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [D] ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko [pekko]

Posted by "ABIDHUSSAIN686 (via GitHub)" <gi...@apache.org>.
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 notifications@pekko.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@pekko.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [D] ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko [pekko]

Posted by "ABIDHUSSAIN686 (via GitHub)" <gi...@apache.org>.
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
      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 notifications@pekko.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@pekko.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [D] ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
GitHub user pjfanning added a comment to the discussion: ContentTooLarge Status Code Not Recognized in Generated Route File Using Guardrail and Pekko

ContentTooLarge exists in Pekko HTTP 1.1.0 and above.

https://github.com/apache/pekko-http/blob/91315b324e7ca45c9a4892b09a0609bb69afa391/http-core/src/main/scala/org/apache/pekko/http/scaladsl/model/StatusCode.scala#L154

GitHub link: https://github.com/apache/pekko/discussions/1537#discussioncomment-10996233

----
This is an automatically sent email for notifications@pekko.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@pekko.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org