Add schemas package for API/Schema versioning scheme#74
Conversation
60b19ba to
7536cba
Compare
|
I moved the repo but haven't update the import references in SMD. I'm going to go ahead and do that real quick for SMD. |
Signed-off-by: David Allen <davidallendj@gmail.com>
Signed-off-by: David Allen <davidallendj@gmail.com>
Signed-off-by: David Allen <davidallendj@gmail.com>
444da15 to
6f014f8
Compare
| @@ -0,0 +1,223 @@ | |||
| package csm | |||
There was a problem hiding this comment.
The hms-xnames project is fairly complete. https://github.com/Cray-HPE/hms-xname
Did you consider using this?
Alternately what you have here is fine. It has the advantage of being simpler and more targeted.
There was a problem hiding this comment.
Yeah, we use that library in other places but the original schemas repo that we're migrating already had this. I'm not opposed to changing it especially if that means less maintenance burden overall.
There was a problem hiding this comment.
It might be better to just leave it how it is for now considering ochami is referencing this package.
https://github.com/OpenCHAMI/ochami/blob/e7577b97cedae5d3bc4bf3a514489f46b80b1491/cmd/smd-rfe-add.go#L10
https://github.com/OpenCHAMI/ochami/blob/e7577b97cedae5d3bc4bf3a514489f46b80b1491/pkg/xname/xname.go#L6
On the other hand, it probably wouldn't be that difficult to refactor those instances to use the hms-xname library.
There was a problem hiding this comment.
That's because I thought we would exclusively stick with our own schemas repo. The only structs in those references are
csm.XNameComponentscsm.RedfishEndpoint
Both of which probably have parallels in hms-xname. If that's the way we want to go, I don't anticipate that it would be too hard to do it in ochami.
There was a problem hiding this comment.
I'd love to deprecate hms-xname altogether. The service should own the schemas it represents.
There was a problem hiding this comment.
Does that mean, in the context of OpenCHAMI, should SMD "own" the xname schema?
|
|
||
| // Envelope structure for schema versioning | ||
| type Envelope struct { | ||
| SchemaID string `json:"schema_id"` |
There was a problem hiding this comment.
Should OpenCHAMI have a recommend property style for json?
What style do you prefer?
At HPE we plan to go with camel case instead of snake case or pascal case in our other products.
For HPE this means
- Lower case first letter.
- Property characters limited to A-Z, a-z, 0-9.
- Abbreviations treated as words. For example we plan to use resourceUri instead of resourceURI.
This mostly only applies to REST APIs using json. It wouldn't apply to what property style is used in a given language (i.e. go, python, etc.)
In my experience, and as far as I remember, I've only ever used JSON with camel case, which is probably just due to the corner of software development that I've spent my time in. So it's just my subjective preference to use camel case. Snake case seems like an equally reasonable preference for someone to have.
There was a problem hiding this comment.
This subject probably should be dealt with in its own RFD and future PRs.
I'm fine with this PR being submitted as is.
There was a problem hiding this comment.
Existing code breaking with the Go stdlib initialism convention ("URI" rather than "Uri") has been slowly driving me mad :)
Either way we'd really need some automated way to enforce them; human enforcement of format standards is tedious and inconsistent.
We'd want to set up https://github.com/ldez/tagliatelle in golangci-lint and bring existing code in line, but that'll be a breaking change and would need to be coordinated across repos.
There was a problem hiding this comment.
Do you want to propose tagliatelle to our common quality standards at the dev summit?
There was a problem hiding this comment.
@shunr-hpe I assume you're referring specifically to the JSON tags in this comment right? I think I've seen snake-case consistently used in our repos thus far.
This PR moves the contents of https://github.com/OpenCHAMI/schemas to SMD to move towards OpenCHAMI/roadmap#78 (comment).