-
Notifications
You must be signed in to change notification settings - Fork 42
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
Missing @is_case_sensitive in JSON (when set to true) #212
Comments
Hey, @marlontaylor: Our goal with the JSON representation is to keep it as small as possible, so we leave out default values. The default value for Does this make sense? Do you think we should re-evaluate that decision? |
hi @gtback , Small JSON representation is usually(if not always) the best decision. Going with the approach of not including the defaults, I have 2 questions:
|
@marlontaylor: You generally can't determine whether the attribute was explicitly set to the default value or if it was not set (and has the default value by default). This is the intent of the default value. It is the value whether or not it was explicitly set. I believe in most cases, if you try to "get" the value of an attribute, it will return the default value even if it wasn't explicitly set. If not, that's something we should fix. Does that answer your question(s)? |
I would consider the uncertainty of determining whether an attribute was included (or not) an issue.
I suggest adding a flag to Choose the best flag structure/format/value. See an example below. # defaulted implies the inclusion of all default values (possible upgrade)
# unmarked implies the unmodified original representation on the STIX object
flag = 'defaulted ' | 'unmarked' | {'output':'defaulted '} | {'output':'unmarked'} | etc. # choose the best format
pprint(stix_package.to_dict(flag)) I think this should handle the cases discussed so far. |
I don't know if I agree. Particularly because the JSON is supposed to be concise and not include unnecessary information, including the default information should not be required. Semantically, there is no difference between the default value being explicitly included and the value being omitted entirely (this is true even in the XML). Also, if you ask for the value of a field in Python, you should get the default value, regardless of whether if it was provided explicitly or if it was omitted. I don't think distinguishing between those two is particularly valuable; if it is, it might be better to just parse with LXML directly. If we want to pass an argument to the |
@is_case_sensitive
is missing from JSON when set totrue
in xml (see AddressObject example below)input.xml
output.json
The text was updated successfully, but these errors were encountered: