Skip to content
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 "sent" key to both Schema and Cred Defs when using Endorsers #1663

Conversation

TheTechmage
Copy link
Contributor

As an Author, if I attempt to publish duplicate schemas or credential definitions, I get a trace stack returned to me complaining about how the signed_txn key does not exist. While I adding a response for that situation (to just return the schema ID/ Cred Def ID instead of an error), I noticed that we were never populating the "sent" key in our responses to controllers. I have standardized the responses to follow the OpenAPI Schema and included the "sent" key.

When publishing a schema that has already been published, we should
respond back with the schema ID, rather than return an error about how
the `signed_txn` key does not exist on the schema_def object.

Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
When publishing a credential definition that has already been published,
we should respond back with the `cred_def_id`, rather than return an
error about how the `signed_txn` key does not exist on the cred_def
object.

Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
The OpenAPI Spec schema indicates that "sent" is a possible field,
however, no code paths (aside from the changes in the last two commits)
returned it. Seeing as the last two commits return it during an error
case, the changes here now return the same data during a successful
case. This should make it easier for controllers to grab the `schema_id`
or the `cred_def_id` under both circumstances.

Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
Add the `sent` key to the response for non-authors to follow the OpenAPI
Schema Specification. Due to the fact that removing the old values would
be a breaking change, I have left those values in for the time being to
allow for a migration path to the new `sent` key.

Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #1663 (9818db8) into main (681e9aa) will decrease coverage by 0.00%.
The diff coverage is 75.00%.

@@            Coverage Diff             @@
##             main    #1663      +/-   ##
==========================================
- Coverage   95.50%   95.50%   -0.01%     
==========================================
  Files         528      528              
  Lines       32734    32738       +4     
==========================================
+ Hits        31264    31266       +2     
- Misses       1470     1472       +2     

@swcurran swcurran merged commit 535f14e into openwallet-foundation:main Mar 14, 2022
@TheTechmage TheTechmage deleted the fix/prevent-error-on-duplicate-schema branch March 14, 2022 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants