Skip to content

Conversation

@flounderpinto
Copy link

@flounderpinto flounderpinto commented Jan 14, 2025

Overview
Fixes #2674. I can't entirely confirm that it doesn't have some unintended side effects, but this does fix the return type of optional values.

Test file:
{ "$schema": "http://json-schema.org/draft-06/schema#", "$ref": "#/definitions/foo", "definitions": { "coordinate": { "type": "object", "required": [ "latitude", "longitude" ], "additionalProperties": false, "properties": { "latitude": { "type": "integer", "minimum": 0, "maximum": 999999 }, "longitude": { "type": "number", "minimum": 0, "maximum": 999999 }, "baz": { "type": "string", "minLength": 0, "maxLength": 999, "pattern": "*" } } }, "coordinates": { "type": "array", "items": { "$ref": "#/definitions/coordinate" } }, "foo": { "type": "object", "required": [ ], "additionalProperties": false, "properties": { "coordinates": { "$ref": "#/definitions/coordinates" }, "bar" : { "type": "number" } } } } }

Diff of generated file changes:
Screenshot from 2025-01-16 09-53-48
Screenshot from 2025-01-16 09-55-05

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Getters for optional values in C++ should return a const reference

1 participant