-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor meta
section of pds4+json and pds4+xml to use ops namespace
#154
Comments
I think this means that you want to modify the swaggerhub spec (yaml) to have Pds4Metadata represent what you are looking for. Currently it is:
Now you want it to be more like:
Is that what you are looking for or did you want something else? Not sure how |
@al-niessner the meta:
type: object
description: |
Meta information for the PDS product including file system
metadata, tracking information, etc. I think down the road we can more strongly type what appears in the section by auto-generating the YAML from the data model, but I don't think we are there yet. Thoughts? @tloubrieu-jpl also, looks like in the swagger spec this object is currently names |
@jordanpadams will add an example for XML |
@jordanpadams , @al-niessner , Since PR NASA-PDS/registry-api#82 the content of the meta tag has not prefix space (then not defined namespace ). This is not fully right but we did not meant to improve that before this ticket does it. |
@tloubrieu-jpl @al-niessner where are we at with this one? am I on the hook for something? |
as a clarification of above, per conversations we had at a breakout, we want this for the meta section for both JSON and XML:
|
so XML example would be something like:
|
Part of the Jackson tool that does the mapping of xml namespaces is the need of a URI for the name. For instance, pds_api has a URI defined in the first tag. When Jackson mapper exchanges a bean to XML it wants the URI not the name and it then translates the URI to pds_api. What is the URI for ops? |
@al-niessner new namespace (which doesn't exist yet but don't tell anyone...): |
Sorry, but this ticket has become really confusing (contradictory). I thought you wanted all 'ops.' to become 'ops:' where 'ops:' is a proper XML namespace with URI given above as https://pds.nasa.gov/pds4/ops/v1. However, when I look a the pds4+xml output this is what I see:
There are no 'ops.'. Do want to the 'pds_api:' to become 'ops:'? Oh, and no I never removed the 'ops.' in any of my code. Maybe gets removed in general PDS4 processing that I inherited. |
Um, same goes with pds4+json
|
What I am seeing does not match the earliest descriptions of what I should be expecting to see. Is what now exists the real desire or should there be changes based on what is now coming out of pds+*? |
@al-niessner apologies for the confusion, the issue from the start is what you see in there now is wrong: Current pds4+xml - NOT QUITE RIGHT <pds_api:meta>
<pds_api:node_name>PSA</pds_api:node_name>
<pds_api:label_file>
<pds_api:file_name>ns_inst.xml</pds_api:file_name>
<pds_api:file_ref>/var/local/harvest/archive/document/ns_inst.xml</pds_api:file_ref>
<pds_api:creation_date>2022-01-24T20:08:23Z</pds_api:creation_date>
<pds_api:file_size>3589</pds_api:file_size>
<pds_api:md5_checksum>a8d09cca0a01728db50c15052c2736cf</pds_api:md5_checksum>
</pds_api:label_file>
<pds_api:data_files>
<pds_api:data_files>
<pds_api:file_name>ns_inst.pdf</pds_api:file_name>
<pds_api:file_ref>/var/local/harvest/archive/document/ns_inst.pdf</pds_api:file_ref>
<pds_api:creation_date>2022-01-24T20:08:23Z</pds_api:creation_date>
<pds_api:file_size>138172</pds_api:file_size>
<pds_api:md5_checksum>8103f20c13a3c321dac4a193aba19d16</pds_api:md5_checksum>
<pds_api:mime_type>application/pdf</pds_api:mime_type>
</pds_api:data_files>
</pds_api:data_files>
</pds_api:meta> This should not be translated to some custom names and elements. I would like them to be more closely tied to what is in the registry. So instead of the mapping above, we would have something like: <pds_api:meta>
<ops:Label_File_Info>
<ops:file_name></ops:file_name>
...
<ops:Data_File_Info>
...
etc.
...
with everything ops:* translated into the XML Same goes for the JSON: "meta": {
"node_name": "PSA",
"label_file": {
"file_name": "ns_inst.xml",
"file_ref": "/var/local/harvest/archive/document/ns_inst.xml",
"creation_date": "2022-01-24T20:08:23Z",
"file_size": "3589",
"md5_checksum": "a8d09cca0a01728db50c15052c2736cf"
},
"data_files": [
{
"file_name": "ns_inst.pdf",
"file_ref": "/var/local/harvest/archive/document/ns_inst.pdf",
"creation_date": "2022-01-24T20:08:23Z",
"file_size": "138172",
"md5_checksum": "8103f20c13a3c321dac4a193aba19d16",
"mime_type": "application/pdf"
}
]
}, More better solution we want: "meta": {
"ops:Label_File_Info": {
"ops:file_name": "ns_inst.xml",
...
}
...
"ops:Data_File_Info": {
"ops:file_name": "ns_inst.pdf",
...
}
...
etc.
...
with everything ops:* translated into the JSON as a note: the Note: I may be off in some of the specifics of the syntax. I don't have a working registry / API available so I can't see what the API output looks like now. hope that makes somewhat sense? |
Thanks that makes my steps clear.
|
@al-niessner 👍 looks good to me. I will allow @tloubrieu-jpl to chime in here in case something else is missing |
Is this what you want (aka did miss anything)? XML output:
and JSON
|
You got your wish. If you add new items to swagger.yml and then fill it, the name will come out right. |
@al-niessner is |
this is done. additional tickets have been created to address additional concerns for the over-arching requirement. |
💡 Description
The flattened
ops
attributes are in the metadata (e.g.ops:Data_File_Info.ops:creation_date_time
).Then it looks like it is being translated / renamed into the API, e.g. for pds4+json response:
Instead, we should keep that namespace as-is, and create the JSON Objects to mimic our
ops
data model. This should not be custom code for each attribute, but instead something generic that just parses out theops:
attributes, and outputs into themeta
object. We may be adding/removing/renamingops:
attributes over time, so we don't want to have to update the API code every time that happens. , e.g.becomes
Similarly, we should map this to XML in the pds4+xml response.
Related requirements
🦄 NASA-PDS/registry-api#440
🦄 NASA-PDS/registry-api#450
The text was updated successfully, but these errors were encountered: