-
Notifications
You must be signed in to change notification settings - Fork 173
Add an option to fallback to comments if a description is not provided #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to fallback to comments if a description is not provided #459
Conversation
9235282
to
1a613e0
Compare
@rideliner please resolve to conflict. We've migrated all tests to kotlin so you can leave it out. I can recreate your test after that. |
The default behavior, to match existing behavior, is to fallback to comments. Setting `commentsAsFallbackDescription` to false in the `SchemaParserOptions` will result in comments not being used when a description is not provided.
1a613e0
to
1235712
Compare
when { | ||
node.description != null -> node.description.content | ||
!options.useCommentsForDescriptions -> null | ||
node.comments.isNullOrEmpty() -> null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two conditions both return null
so you could just combine them into one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 🚀
Closing this since we're unable to push/merge it as it is. Opened #564 with the same commits. |
Checklist
Description
The existing behavior is to always fallback to comments from the schema. This change would add a configuration option to
SchemaParserOptions
that would make it possible to ignore comments and exclusively use descriptions from the schema.For example:
This schema with the current behavior would result in the description being
Copyright 2020\nAuthors: ...
.With the
commentsAsFallbackDescription
option set as false, the description will be null.