Skip to content

Commit

Permalink
Merge pull request #3708 from nspcc-dev/rpcwrapper
Browse files Browse the repository at this point in the history
cli: add check config field for `generate-rpcwrapper`
  • Loading branch information
AnnaShaleva authored Nov 29, 2024
2 parents 3b7a7dc + 870421e commit 7ba295c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cli/smartcontract/generate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package smartcontract

import (
"bytes"
"fmt"
"os"
"strings"
Expand All @@ -17,7 +18,8 @@ var generatorFlags = []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "Configuration file to use",
Usage: `Configuration bindings file to use (*.yml). Configuration file is
generated by 'contract compile' command with --bindings flag`,
},
&cli.StringFlag{
Name: "manifest",
Expand Down Expand Up @@ -95,7 +97,10 @@ func contractGenerateSomething(ctx *cli.Context, cb func(binding.Config) error)
if err != nil {
return cli.Exit(fmt.Errorf("can't read config file: %w", err), 1)
}
err = yaml.Unmarshal(bs, &cfg)
decoder := yaml.NewDecoder(bytes.NewReader(bs))
decoder.KnownFields(true)

err = decoder.Decode(&cfg)
if err != nil {
return cli.Exit(fmt.Errorf("can't parse config file: %w", err), 1)
}
Expand Down

0 comments on commit 7ba295c

Please sign in to comment.