Skip to content

Commit

Permalink
make unit tests pass finally
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Oct 26, 2020
1 parent 223eeb2 commit 0027917
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/core/test/unit/Cardano/Wallet/Api/TypesSpec.hs
Expand Up @@ -1870,6 +1870,7 @@ instance ToSchema ApiPubKey where
instance ToSchema ApiCredentials where
declareNamedSchema _ = do
addDefinition scriptValueSchema
addDefinition credentialValueSchema
declareSchemaForDefinition "ApiCredentials"

instance ToSchema Credential where
Expand Down Expand Up @@ -1929,6 +1930,11 @@ scriptValueSchema =
NamedSchema (Just "ScriptValue") $ mempty
& additionalProperties ?~ AdditionalPropertiesAllowed True

credentialValueSchema :: NamedSchema
credentialValueSchema =
NamedSchema (Just "CredentialValue") $ mempty
& additionalProperties ?~ AdditionalPropertiesAllowed True

-- | Utility function to provide an ad-hoc 'ToSchema' instance for a definition:
-- we simply look it up within the Swagger specification.
declareSchemaForDefinition :: Text -> Declare (Definitions Schema) NamedSchema
Expand Down
14 changes: 11 additions & 3 deletions specifications/api/swagger.yaml
Expand Up @@ -330,6 +330,11 @@ x-credentialPubKey: &credentialPubKey
0: addr_vk13pfp60uf4ru7cmj5d57xjdzj6lagn328ah67h35urqrl92jn094z0s07fcy2pvfw3xfhna6fa24na8nk6lraymjcrl5wwj6chsjqtjqlfw44z
1: stake_vk13pfp60uf4ru7cmj5d57xjdzj6lagn328ah67h35urqrl92jn094z0s07fcy2pvfw3xfhna6fa24na8nk6lraymjcrl5wwj6chsjqtjqlfw44z

x-credential: &credential
nullable: false
additionalProperties:
$ref: "#/components/schemas/CredentialValue"

x-script: &script
description: |
Script allows establishing either spending or staking guard that could be removed
Expand Down Expand Up @@ -1526,9 +1531,7 @@ components:
pub_key: *credentialPubKey

ApiCredential: &ApiCredential
oneOf:
- <<: *ApiPubKey
- <<: *ApiScript
<<: *credential

ApiCredentials: &ApiCredentials
type: object
Expand Down Expand Up @@ -1724,6 +1727,11 @@ components:
passphrase: *lenientPassphrase
address_index: *addressIndex

CredentialValue: &CredentialValue
oneOf:
- <<: *ApiPubKey
- <<: *ApiScript

ScriptValue: &ScriptValue
oneOf:
- title: Require Key Hash
Expand Down

0 comments on commit 0027917

Please sign in to comment.