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.

$refs in parameter is not processed

See original GitHub issue

I expect

$refs in parameters to be processed, eg

paths:
  /foo:
    parameters:
    - $ref: '#/components/parameters/MyParam'
components:
  parameters:
    MyParam:
      name: foo
      schema:
        type: string

Instead

I get KeyError

  File "/usr/local/lib/python3.8/site-packages/fastapi_code_generator/parser.py", line 207, in get_parameter_type
    schema: JsonSchemaObject = JsonSchemaObject.parse_obj(parameter["schema"])
KeyError: 'schema'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:29 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
koxudaxicommented, Jun 20, 2021

@oktavlachs

I didn’t know it.

Do you know what the differences or (dis-)/advantages are from your project?

I guess openapi-generator-cli supports openapi features like multiple status codes of responses. (But, We can implement the features to fastapi-code-generator.) Also, the code-generator creates project files (tests, docker file, …)

However, openapi-generator-cli can generate only a simple model. https://github.com/OpenAPITools/openapi-generator/commit/0da409986889dcfab1420fb1410ae9509a5834c8#diff-b667e564efa49b2fa6b6d766c52b062dc73f3e6444046e34d9457d6e532e91e0

fastapi-code-generator use datamodel-code-generator to generate models. The datamodel-code-generator supports a lot of features. For example, allOf is created as an inherited class. I believe definitely this is the best advantage.

Btw, datamodel-code-generator is used in a lot of projects. It’s download about 100k per month. Famous tech compies convert complex and large Schema files to pydantic models by datamodel-code-generator . 😉

If fastapi-code-generator can call all features of datamodel-code-generator then I guess fastapi-code-generator becomes an awesome tool to generate fastapi and pydnatic code.

2reactions
ioggstreamcommented, May 3, 2021

@koxudaxi yes, parameters can accept content in OAS3. It is the first time I see it though 😃 https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md#parameterObject

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Method Parameters with ref not working - Stack Overflow
Create a string variable and supply this to your "AbendProgram" method. The error message is telling you what's wrong. A ref or out...
Read more >
7302 (h264_nvenc / b_ref_mode middle with refs parameter is ...
Hello,. b_ref_mode option with refs parameter is not working, giving out below error: InitializeEncoder failed: invalid param (8).
Read more >
Common Query Parameters | Apache Solr Reference Guide 6.6
An empty list will log no parameters, so if logging all parameters is desired, ... Solr should use to process the main query...
Read more >
Pseudo parameters reference - AWS CloudFormation
Lists the details of the available pseudo parameters that are predefined by AWS CloudFormation.
Read more >
MATLAB fminsearch - Optimization - MathWorks
Sometimes your objective function has extra parameters. These parameters are not variables to optimize, they are fixed values during the optimization.
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