code-gov-web icon indicating copy to clipboard operation
code-gov-web copied to clipboard

`status` == empty string

Open IanLee1521 opened this issue 7 years ago • 8 comments

In the 2.0 schema — Given that status is optional and accepts a string, would it be reasonable to expect an empty string to be an acceptable value?

Currently, https://code.gov/#/policy-guide/docs/compliance/inventory-code/tools/validate-schema doesn't validate correctly if I have the following in my code.json:

    ...
    "status": "",
    ...

IanLee1521 avatar Dec 13 '17 17:12 IanLee1521

@IanLee1521 Does it validate if you do not include the "status" key at all? I believe that is our preference for treating optional keys.

We could work on adding empty strings or nulls if that fits your workflow better, though. Let me know!

zachary-kuhn avatar Dec 15 '17 16:12 zachary-kuhn

@zachary-kuhn -- It does validate if I remove that key, but I think that is the only field that has this problem (see disclaimerText or disclaimerURL for two examples of several.

I have been working on https://github.com/llnl/scraper as a means to produce code.json files automatically, and in the current implementation (https://github.com/LLNL/scraper/blob/c1a8c36230e860a02e36843cbf2b63eb9d919f2e/scraper/code_gov/init.py#L219) I set all the fields in advance at object creation, before I know if the values will be provided by some process.

IanLee1521 avatar Dec 15 '17 18:12 IanLee1521

@IanLee1521 , I'll be working on this. I'll make sure to keep you updated.

DanielJDufour avatar Jan 16 '18 20:01 DanielJDufour

Thanks @DanielJDufour ! Let me know if you need any additional information or testing from me.

IanLee1521 avatar Jan 16 '18 20:01 IanLee1521

@IanLee1521 , could you attach/share the JSON file that you're trying to get validated/ingested with the empty string for status? Thanks!

DanielJDufour avatar Jan 16 '18 20:01 DanielJDufour

Sure thing. Here you go (adapted from https://energy.gov/code.json which was how I discovered this), it's a JSON formatted .txt file because apparently GitHub doesn't allow uploading .json files...

empty_status.txt

IanLee1521 avatar Jan 16 '18 20:01 IanLee1521

Thank you. Just a quick update. We're still discussing this as a team and we'll get back to you when a decision is made.

DanielJDufour avatar Feb 02 '18 15:02 DanielJDufour

Thanks!

IanLee1521 avatar Feb 02 '18 17:02 IanLee1521