feat(crafting-schema): add organization resolver#2465
feat(crafting-schema): add organization resolver#2465Piskoo merged 2 commits intochainloop-dev:mainfrom
Conversation
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
| return "", err | ||
| } | ||
|
|
||
| return resourceBase.Metadata.Organization, nil |
There was a problem hiding this comment.
what if it doesn't have metadata as is an old format?
There was a problem hiding this comment.
Updated unmarshalling to not return an error when old schema is used
| return "", nil | ||
| } | ||
| // Convert bytes to base64 string for consistent handling | ||
| return base64.StdEncoding.EncodeToString(rawBytes), nil |
There was a problem hiding this comment.
why return strings and not bytes?
There was a problem hiding this comment.
Removed, it was there to make it consistent with platform
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
| // Extracts raw data | ||
| func getRawData(req interface{}) ([]byte, error) { | ||
| // Check if the request implements RequestWithRawContract | ||
| if rawContractReq, ok := req.(RequestWithRawContract); ok { |
There was a problem hiding this comment.
This is superspecific to contracts. I think we can deprecate the field raw_contract in the proto definition and call it raw_resource, for example, just to make it generic enough so that we can reuse this interface for other resources (policies, etc). Would it be possible?
There was a problem hiding this comment.
I think we are using raw_schema in other places.
There was a problem hiding this comment.
Naming is all over the place, policies use raw_schema, policy groups raw_group, contracts raw_contract. Chainloop OSS will be only responsible for contracts so I think there's no need to add another field to proto def
This PR updates current organization middleware with handler for in schema defined organization.