Skip to content

nullable is incorrectly parsed from metadata  #98

Closed

Description

@homutov

The following code is used to parse 'nullable' parameter from metadata:
self._nullable = bool(nullable) (VariableDeclaration line #606)

The problem is that 'nullable' parameter is passed as a string value ("true" or "false") or None. So bool(nullable) treats both "true" and "false" values as True. Moreover, the default or missing value (None) should be treated as nullable, but it's not.

Activity

  1. filak-sap commented on Apr 27, 2020

    @filak-sap
    Contributor

    Yay, that's embarrassing. Are you going to open a PR?

  2. added 3 commits that reference this issue on Apr 29, 2020
    c776c12
    4f06094
    445b94e
  3. homutov commented on Apr 29, 2020

    @homutov
    Author

    @filak-sap I haven't noticed that you've created already a PR and created another one.

    There're some differences between your fix and mine:

    • After some research I think that 'VariableDeclaration' is not the right place to parse string values. Moved it to a different place also to make consistent with other bool attributes.
    • I use different default values for 'Nullable' attribute in properties and parameters (function imports). Not sure it's the right thing to do (cannot find the specification for Parameters in the OData protocol specification), but it keeps my changes compatible with the existing tests.

    Could you please take a look?

  4. filak-sap commented on Apr 29, 2020

    @filak-sap
    Contributor

    I was not sure about the FunctionImport parameters. The documentation is not clear and contains the information that "Nullable" is described elsewhere, so I decided to change the behaviour.

    Anyways, I'll use your patch - I already dropped my patch from the PR.

    Just sign the CLA, please.

  5. homutov commented on Apr 29, 2020

    @homutov
    Author

    @filak-sap signed CLA (took some time - had a type and my email and could not sign) and fixed the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions