Skip to content
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

fix #3094 - avoid duplicate fields in schema classes #3102

Merged
merged 1 commit into from
Feb 4, 2019

Conversation

padamstx
Copy link
Contributor

@padamstx padamstx commented Feb 1, 2019

Why:
The various Schema subclasses (ArraySchema, BinarySchema, etc.) are
defined such that they actually duplicate some of the fields from
the Schema super class (e.g. type, format, default, etc.). This
can create confusion when examining instances of these classes within
a debugger as you will see two "type" fields for example, the base class'
"type" field will be set to null and the subclass' "type" field will be set
to "array" (or "binary", or "boolean", etc.). We have similar issues with
the format and default fields.

What:
In this PR, I've fixed this by adding a protected ctor to Schema, and default ctors to
the subclasses, plus I've removed some getters/setters from the subclasses
that are no longer needed.

Why:
The various Schema subclasses (ArraySchema, BinarySchema, etc.) are
defined such that they actually duplicate some of the fields from
the Schema super class (e.g. type, format, default, etc.).  This
can create confusion when examining instances of these classes within
a debugger as you will see two "type" fields for example, the base class'
"type" field will be set to null and the subclass' "type" field will be set
to "array" (or "binary", or "boolean", etc.).   We have similar issues with
the format and default fields.

What:
In this PR, I've fixed this by adding a protected ctor to Schema, and default ctors to
the subclasses, plus I've removed some getters/setters from the subclasses
that are no longer needed.
@padamstx
Copy link
Contributor Author

padamstx commented Feb 1, 2019

Please disregard the name of my bug branch. I don't know where I got "342". Should have named it "issue-3094" :)

@padamstx
Copy link
Contributor Author

padamstx commented Feb 1, 2019

cc: @frantuma

@frantuma frantuma merged commit a2b0efd into swagger-api:master Feb 4, 2019
@frantuma
Copy link
Member

frantuma commented Feb 4, 2019

Thanks!

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.

2 participants