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.

Generator ignores nullability

See original GitHub issue

Description

    Service:
      type: object
      properties:
        Услуга:
          type: string
        Стоимость:
          type: number
          format: ₴
          nullable: false
        Обязательная:
          type: boolean
          nullable: false

Expected behavior

Properties of value type marked as nullable: false declared as non-nullable and has a non-nullable parameter in a constructor

Actual behavior

nullable: false is ignored

Related information

1.0.0-Beta1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Numpsycommented, Apr 13, 2021

Could that be because the fields aren’t marked as required in the schema, so the generated properties have to be optional to handle them not being present in the Json data?

0reactions
sergey-tihoncommented, Jan 31, 2021

Here is the line where we determine if the property is optional. https://github.com/fsprojects/SwaggerProvider/blob/net5/src/SwaggerProvider.DesignTime/v3/DefinitionCompiler.fs#L202

Is easiest way to debug is to put breakpoint on this line and check how Microsoft.OpenApi.Readers passed your schema.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG][JAVA] Client generator ignores 'nullable' property
Description Client generator ignores 'nullable' property of the object schema. ... Nullable generation seems to be based on 'required' property.
Read more >
Openapi generator maven plugin nullable property problem
A property can be mentioned as nullable to pass null value in openApi. OpenApi generator wraps the datatype with JsonNullable as shown below ......
Read more >
Nullable reference types
That means it's possible for callers to ignore warnings, intentionally use null as an argument to a method expecting a non nullable reference....
Read more >
Ignore Null Fields with Jackson
This quick tutorial is going to cover how to set up Jackson to ignore null fields when serializing a java class.
Read more >
Field Calculator: ignore NULL value
Hey, I am using a File Geodatabase and I want to calculate the sum of different coulms. like column5= [column1]+[column2]+[column3]
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