Skip to content

Chaotic generates bad parser for required nullable integer field #1108

@alex-aparin

Description

@alex-aparin

Bad parser for required nullable integer field

`

 def cpp_field_parse_type(self) -> str:
     type_ = self.schema.parser_type('TODO', self.name.title())
     if self.required or self._default() is not None:
           return type_
     else:
           return f'std::optional<{type_}>'

`

This code (or maybe parser_type method for primitive type) does not respect case when field can be required and nullable at the same time for primitive integer field. Final type will be chaotic::primitive<int> instead of std::optional<chaotic::primitive<int>>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions