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.

Sort generated required body and query/path parameters

See original GitHub issue

Bug report

Given OAS3 like this:

paths:
  /{ueId}/sdm-subscriptions:
    post:
      summary: subscribe to notifications
      operationId: Subscribe
      tags:
        - Subscription Creation
      parameters:
        - name: ueId
          in: path
          description: Identity of the user
          required: true
          schema:
            $ref: 'http://localhost:8081/29.571/16.7.0/TS29571_CommonData.yaml#/components/schemas/VarUeId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SdmSubscription'
        required: true

Expected behaviour: The required body is generated BEFORE the optional parameters in the Python code.

image

Actual behaviour: The required body is generated AFTER the optional parameters in the Python code. I have to bring it into the right order by hand to solve the issue.

image

Solution: Put the body function parameter before the other function parameters at the beginning of the parameter list.

Absolutely minor bug, but I thought I report it. Thanks!

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
sa4zetcommented, Jun 17, 2021

Yes. I didn’t change the order. I think the changing order may cause injecting a bug. We usually expect the same order for each method.

It’s not a problem, just an observation ^^

2reactions
oktavlachscommented, Oct 16, 2021

@koxudaxi @sa4zet Can we close this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with RESTful API Query, Body, and Path Parameters
If you're starting fresh with RESTful APIs, check out this easy introduction to parameter types.
Read more >
Query Parameters - FastAPI
Here the query parameter needy is a required query parameter of type str . If you open in your browser a URL like:...
Read more >
retrofit 2 @path Vs @query - java - Stack Overflow
It took me a week trying to fix it though by using a non parameter call fetched the resources; So tried to change...
Read more >
Registration Data Access Protocol (RDAP) Query Parameters ...
Registration Data Access Protocol (RDAP) Query Parameters for Result Sorting and Paging · 1. Introduction · 2. RDAP Query Parameter Specification · 3....
Read more >
Package overview — drf-spectacular documentation
Helper class to document a API parameter / request body / response body with a ... Literal[query, path, header, cookie] = 'query', required:...
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