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

Validate openrpc.json in CI #6486

Open
Tracked by #6480
ValentinTrinque opened this issue Oct 12, 2022 · 0 comments
Open
Tracked by #6480

Validate openrpc.json in CI #6486

ValentinTrinque opened this issue Oct 12, 2022 · 0 comments
Labels
Milestone

Comments

@ValentinTrinque
Copy link
Contributor

ValentinTrinque commented Oct 12, 2022

Add a document structure validation, in the CI. It's possible to add it as a go test using the official golang marshaller:
https://github.com/open-rpc/meta-schema/blob/master/openrpc_document.go

However, the file doesn't compile because it's missing the definition of Undefined.

In the meantime, we already have tests that (should) ensure the documentation is in sync with the code.

Prototype

package api_test

import (
	vgfs "code.vegaprotocol.io/vega/libs/fs"
	"github.com/open-rpc/meta-schema"
	"github.com/stretchr/testify/require"

	"encoding/json"
	"testing"
)

func TestOpenRPCDocumentIsValid(t *testing.T) {
	rawFileContent, err := vgfs.ReadFile("./openrpc.json")
	require.NoError(t, err)

	document := &openrpc_document.OpenrpcDocument{}
	err = json.Unmarshal(rawFileContent, document)
	require.NoError(t, err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

3 participants