You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating code from a YAML schema definition that uses folded blocks for descriptions, the comments in the generated output code have a trailing comment line.
"$schema": "http://json-schema.org/draft-04/schema#""$id": "https://example.com/yaml_formatting"title: MyObjecttype: objectproperties:
foo:
description: > I'm a multiline description in a folded block. Folded blocks should not have hard line breaks after parsing. They should also not end in a line break.type: stringbar:
description: | I'm a multiline description in a literal block. Literal blocks, on the other hand, should have hard line breaks and may end in a line break, too. This may look funky when Go code is generated to a specific line width, though.type: string
Expected Output
// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.package test
typeYamlMultilineDescriptionsYamlstruct {
// I'm a multiline description in a literal block. Literal blocks, on the other// hand,// should have hard line breaks and may end in a line break, too.//// This may look funky when Go code is generated to a specific line width, though.//Bar*string`json:"bar,omitempty" yaml:"bar,omitempty"`// I'm a multiline description in a folded block. Folded blocks should not have// hard line breaks after parsing. They should also not end in a line break.Foo*string`json:"foo,omitempty" yaml:"foo,omitempty"`
}
Actual Output
// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.package test
typeYamlMultilineDescriptionsYamlstruct {
// I'm a multiline description in a literal block. Literal blocks, on the other// hand,// should have hard line breaks and may end in a line break, too.//// This may look funky when Go code is generated to a specific line width, though.//Bar*string`json:"bar,omitempty" yaml:"bar,omitempty"`// I'm a multiline description in a folded block. Folded blocks should not have// hard line breaks after parsing. They should also not end in a line break.//Foo*string`json:"foo,omitempty" yaml:"foo,omitempty"`
}
The text was updated successfully, but these errors were encountered:
When generating code from a YAML schema definition that uses folded blocks for descriptions, the comments in the generated output code have a trailing comment line.
The issue may be related to go-yaml/yaml#789.
Example
Input
Expected Output
Actual Output
The text was updated successfully, but these errors were encountered: