-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add missing id, name fields to json schema docs #1233
Conversation
|
✅ Deploy Preview for fdc3 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @hellosmithy, technically the which end up in the TypeScript types generated from the resulting composed schema: FDC3/src/context/ContextTypes.ts Lines 1247 to 1266 in dcd98c2
However, it's not really inheritance (composition of schemas is more like layering filters over one another) and there is no problem defining them in multiple schemas that get composed together. You'll note we use the Finally, a note for the maintainers, the preview for PR #1151 (generate Context docs from schemas) shows that the docs generation script is not picking up the composed schema refs and rendering the Context schema properties: https://issue-1068--exquisite-otter-12d363.netlify.app/docs/context/schemas/Contact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - although we should review if there are more schemas that need a similar change
@hellosmithy Once you've got a CLA manger setup, please click on the Please click here to be authorized link above to have EasyCLA check it and add you to its database of approved contributors, which will allow us to merge this once reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @kriswest mentioned there are a few other other context types missing id and/or name (see my comment here #1151 (review) )
- Country is missing name
- Organization is missing name
- Portfolio is missing name and id
- Position is missing name and id
- TradeList is missing name and id
Ah yes, I knew about the composition but didn't realise it included |
Added the optional id and name fields which are documented on the FINOS site but currently missing from: - Contact (name) - ContactList (name, id) - Country (name) - OrderList (name, id) - Organization (name) - InstrumentList (name, id) - Portfolio (name, id) - Position (name, id) - TradeList (name, id)
13ccdd2
to
64c5e78
Compare
Slight tangent, but are
|
Ah yes, I knew about the composition but didn't realise it included id and name. For some reason the json-schema-to-typescript npm package I'm using to generate some types also doesn't appear to pick these up which is what brought my attention to it.
If I remember rightly, json-schema-to-typescript doesn't retrieve references ($ref). You can can do that yourself by just replacing the $ref element with the referenced schema. https://www.npmjs.com/package/json-schema-resolver I think can do that for you as well.
In the FDC3 repo we use quicktype (which possibly combines these two libs under-the-hood) to generate typescript types from the schemas.
|
Slight tangent, but are type fields supposed to be case sensitive or insensitive? TimeRange<https://fdc3.finos.org/schemas/2.1/context/timerange.schema.json> has camel case in the example, but lowercase in the schema
They are case-sensitive, so the example there is wrong. I'll get that fixed. Many thanks for pointing it out!
|
@hellosmithy could you run I should probably have this added to the pre-commit hook so that it's automated! |
/** | ||
* An optional human-readable name for the contact | ||
* | ||
* An optional human-readable summary of the contact list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again
@hellosmithy I was able to improve the naming of the generated object, but not stop it from doubling up on the comments. What's happening is that quicktype is combining two schemas which a field could be In ChatSearchCriteria each criteria could be an instrument, a contact, an organisation or a free text string. I was at least able to get the object named properly (to FDC3/src/context/ContextTypes.ts Lines 791 to 798 in 5e3eee3
|
/easycla |
@hellosmithy any joy on the CLA front? If there's anything we or FINOS can do to help let us know! |
@kriswest not yet other than that it's going through the various channels - should I close this PR until we have an update? |
No problem leaving it open. If its likely to take more than a few weeks we'll recreate the changes in a new PR to close out the issue. |
@hellosmithy any update on that approval/CLA? We're talking about prereleases for review and it would be good to get this in... |
@kriswest it's been raised to all the people it needs to be, but we don't yet have an ETA I'm afraid. |
superseded by #1360 |
Added the optional
id
andname
fields which are documented on the FINOS site but currently missing fromOrderList
,InstrumentList
,ContactList
andContact
(name only) json schema docs.See: