Skip to content

x-scala-empty-is-null does not work with snake-cased parameters #145

@blast-hardcheese

Description

@blast-hardcheese

Given the following definition:

definitions:
  Foo:
    type: object
    properties:
      bar_baz:
        type: string
        x-scala-type: NonEmptyString
        x-scala-empty-is-null: true

x-scala-empty-is-null does not seem to do anything. Changing the spec to just be bar or just baz produces the expected behaviour (flatMapping on the parsed string value, sinking to null if empty).

I've traced this through and found if (emptyToNullKeys contains param.name) compares the normalized parameter name to the original parameter name. Suggestion is to replace this code with a boolean, as we're threading through the same value in two different fields, just to do an incorrect comparison at the end.

Metadata

Metadata

Labels

bugUnexpected behaviour for functionality that either was intended to work, or has worked in the pastscalaBroadly concerning Scala code generation or the generated Scala code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions