Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hosamaly
Copy link
Contributor

@hosamaly hosamaly commented Mar 19, 2018

This PR is work in progress. It's also a request for comments.

In this PR, I'm trying to figure out the best way to represent fixed attributes. There are different options I can think of, but I'm not sure which one is best...

  1. Treat fixed attributes as a private implementation detail.
    • Ignore the attribute's value when parsing XML.
    • Write the attribute's value when writing XML.
    • In this PR, there is no way to inspect the value from the generated Scala classes.
      • It's possible to add a getter that always returns the correct value, but then it may not represent the value that was actually in the parsed XML (which may or may not be valid).
  2. Treat fixed attributes as an optional attribute.
    • The generated classes would support both reading and writing of these values.
    • If an invalid value is found during parsing, throw an exception to indicate non-validity.
    • If an invalid value is found during writing, throw an exception to indicate non-validity.

I went with the first approach and created this PR, the results of which can be seen in this diff. It's possible to put this change behind a feature flag, but I'd like some feedback on the approach first.

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.

1 participant