Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion scls-cardano/cddl-validate/Cardano/SCLS/CDDL/Validate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ validSpecs :: Map.Map SomeNamespaceSymbol (CTreeRoot Codec.CBOR.Cuddle.CDDL.Reso
validateBytesAgainst :: ByteString -> Text -> Text -> Maybe (Evidenced ValidationTrace)
validateBytesAgainst bytes namespace name = do
cddl <- namespaceSymbolFromText namespace >>= flip Map.lookup validSpecs
pure $ validateCBOR bytes (Name name) (mapIndex cddl)
case validateCBOR bytes (Name name) (mapIndex cddl) of
Right res -> pure res
Left _ -> Nothing
10 changes: 5 additions & 5 deletions scls-cardano/scls-cardano.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ library
build-depends:
base >=4.18 && <5,
containers,
cuddle >=1.7,
cuddle >=1.8,
heredoc >=0.2,
scls-core,
text,
Expand All @@ -68,7 +68,7 @@ library validate
base >=4.18 && <5,
bytestring,
containers,
cuddle >=1.7,
cuddle >=1.8,
scls-cardano,
scls-core,
text,
Expand All @@ -90,7 +90,7 @@ library testlib
base16-bytestring,
bytestring,
cborg,
cuddle >=1.7,
cuddle >=1.8,
hspec,
hspec-expectations,
scls-cardano:{validate},
Expand All @@ -108,7 +108,7 @@ executable gen-cddl
main-is: Main.hs
build-depends:
base >=4.18 && <5,
cuddle >=1.7,
cuddle >=1.8,
directory >=1,
filepath >=1.4,
prettyprinter,
Expand All @@ -134,7 +134,7 @@ test-suite scls-cardano-test
bytestring,
cborg,
containers,
cuddle >=1.7,
cuddle >=1.8,
directory,
filepath,
hspec,
Expand Down
2 changes: 1 addition & 1 deletion scls-core/scls-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ library
base >=4.18 && <5,
bytestring,
cborg,
cuddle >=1.7,
cuddle >=1.8,
mempack-scls,
2 changes: 1 addition & 1 deletion scls-format/scls-format.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test-suite scls-format-test
cborg >=0.2,
containers,
crypton,
cuddle >=1.7,
cuddle >=1.8,
filepath,
hspec,
hspec-expectations,
Expand Down
2 changes: 1 addition & 1 deletion scls-util/scls-util.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ library
cborg,
containers,
crypton,
cuddle >=1.7,
cuddle >=1.8,
directory,
filepath,
mempack-scls,
Expand Down
5 changes: 3 additions & 2 deletions scls-util/src/Cardano/SCLS/Util/Verify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ validateCDDLAgainst :: CTreeRoot MonoReferenced -> (Int, GenericCBOREntry n) ->
validateCDDLAgainst cddl (seqNum, GenericCBOREntry (ChunkEntry _key cTerm)) =
let name = Name (T.pack "record_entry")
in case validateCBOR (getEncodedBytes cTerm) name (mapIndex cddl) of
Evidenced SValid _ -> Nothing
Evidenced SInvalid trc -> Just (CDDLValidationError seqNum trc)
Left e -> Just (CBORParseError seqNum . T.pack $ show e)
Right (Evidenced SValid _) -> Nothing
Right (Evidenced SInvalid trc) -> Just (CDDLValidationError seqNum trc)

-- | Format an error for display.
formatError :: CheckError -> String
Expand Down
Loading