question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG][PYTHON] Client response is not respecting capital letters

See original GitHub issue

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What’s the actual output vs expected output?
  • [] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Python response containing keys in capital letters are being converted to lowercase. Therefore, schema is not being respect. I’m not sure if attribute map should be done at response time.

openapi-generator version

3.0.3

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Sample service
  version: 0.0.1
  description: response wrongly capitalized
paths:
  /foo:
    post:
      operationId: foo
      description: hello
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MyRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MyResponse'
components:
  schemas:
    MyRequest:
      type: object
      properties:
        hello: 
          type: string
    MyResponse:
      type: object
      properties:
        QUICK:
          type: boolean
          readOnly: true
          default: false
        FOX:
          type: boolean
          readOnly: true
          default: false
      required:
      - QUICK
      - FOX
Generation Details

Python client was generated with default settings using the docker image provided (latest)

Steps to reproduce
  1. Call your endpoint that returns capitalized letters. Response should be something like:
{
    "QUICK": "foo",
    "FOX": "bar"
}
  1. Python client parses response above and returns all entries in lowercase.
{
    "quick": "foo",
    "fox": "bar"
}
Related issues/PRs
Suggest a fix

It’s ok controlling this in a request scenario, where the arguments to your class object are all lowercase but regarding the response, I don’t this this parsing as valuable as API’s consumer expects to receive a response matching the schema definition, which is not happening currently. Expected output should mimic the schema:

{
    "QUICK": "foo",
    "FOX": "bar"
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
spacethercommented, Jan 5, 2022

Heads up there is a new client, python-experimental which uses spec naming for all endpoint parameters and model properties. It was added in: #8325

1reaction
gmcrocetticommented, Sep 29, 2021

Alright, sounds good to me. Feel free to close 😃. Thanks a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Jackson 2 not recognize the first capital letter if the ...
The problem you are seeing is due to the fact that Jackson uses Java Bean naming conventions to figure out the the Json...
Read more >
3. Capitalization Rules - GovInfo
In formal lists of delegates and representatives of governments, all titles and descriptive designations immediately following the names should be capitalized ...
Read more >
USING EMAIL ETIQUETTE - Stony Brook
Do not use ALL capital letters to emphasize or highlight your message. This is considered to be rude, and can be interpreted as...
Read more >
CL_HTTP_CLIENT Header Uppercase Error REST
Hi , I'm trying to consume a API REST from SAP . The web service request as header "efacturaAuthorizationToken" , with the capital...
Read more >
Change the capitalization or case of text - Microsoft Support
Go to Home > Change case . Do one of the following: To capitalize the first letter of a sentence and leave all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found