-
Notifications
You must be signed in to change notification settings - Fork 982
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 new API Version to validate when setting fields not defined in the schema #4894
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
02c4328
build(deps): bump chrono from 0.4.26 to 0.4.31 (#4876)
dependabot[bot] ce27a4d
build(deps): bump webpki from 0.22.0 to 0.22.1 (#4857)
dependabot[bot] 648dedd
runtime: only include valid fields in entity for store_set
incrypto32 7e132f0
graph, runtime: add new apiVersion to validate fields not defined in …
incrypto32 af14d42
graph: update tests for setting invalid field
incrypto32 2289fea
tests: add runner tests for undefined field setting validation in api…
incrypto32 d25c639
graph: add check_invalid_fields method to HostExports
incrypto32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": false, | ||
"internalType": "string", | ||
"name": "testCommand", | ||
"type": "string" | ||
} | ||
], | ||
"name": "TestEvent", | ||
"type": "event" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"apiVersion": "0.0.7" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"apiVersion": "0.0.8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "api-version", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"build-contracts": "../../common/build-contracts.sh", | ||
"codegen": "graph codegen --skip-migrations", | ||
"test": "yarn build-contracts && truffle test --compile-none --network test", | ||
"create:test": "graph create test/api-version --node $GRAPH_NODE_ADMIN_URI", | ||
"prepare:0-0-7": "mustache data.0.0.7.json subgraph.template.yaml > subgraph.yaml", | ||
"prepare:0-0-8": "mustache data.0.0.8.json subgraph.template.yaml > subgraph.yaml", | ||
"deploy:test-0-0-7": "yarn prepare:0-0-7 && graph deploy test/api-version-0-0-7 --version-label 0.0.7 --ipfs $IPFS_URI --node $GRAPH_NODE_ADMIN_URI", | ||
"deploy:test-0-0-8": "yarn prepare:0-0-8 && graph deploy test/api-version-0-0-8 --version-label 0.0.8 --ipfs $IPFS_URI --node $GRAPH_NODE_ADMIN_URI" | ||
}, | ||
"devDependencies": { | ||
"@graphprotocol/graph-cli": "0.53.0", | ||
"@graphprotocol/graph-ts": "0.31.0", | ||
"solc": "^0.8.2" | ||
}, | ||
"dependencies": { | ||
"@truffle/contract": "^4.3", | ||
"@truffle/hdwallet-provider": "^1.2", | ||
"apollo-fetch": "^0.7.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-register": "^6.26.0", | ||
"gluegun": "^4.6.1", | ||
"mustache": "^4.2.0", | ||
"truffle": "^5.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type TestResult @entity { | ||
id: ID! | ||
message: String! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Entity, Value, store } from "@graphprotocol/graph-ts"; | ||
import { TestEvent } from "../generated/Contract/Contract"; | ||
import { TestResult } from "../generated/schema"; | ||
|
||
export function handleTestEvent(event: TestEvent): void { | ||
let testResult = new TestResult(event.params.testCommand); | ||
testResult.message = event.params.testCommand; | ||
let testResultEntity = testResult as Entity; | ||
testResultEntity.set( | ||
"invalid_field", | ||
Value.fromString("This is an invalid field"), | ||
); | ||
store.set("TestResult", testResult.id, testResult); | ||
testResult.save(); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo: s/doesnt/don't/