在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:json-schema-org/JSON-Schema-Test-Suite开源软件地址:https://github.com/json-schema-org/JSON-Schema-Test-Suite开源编程语言:Python 100.0%开源软件介绍:JSON Schema Test SuiteThis repository contains a set of JSON objects that implementers of JSON Schema validation libraries can use to test their validators. It is meant to be language agnostic and should require only a JSON parser. The conversion of the JSON objects into tests within a specific language and test framework of choice is left to be done by the validator implementer. CoverageAll JSON Schema specification releases should be well covered by this suite, including drafts 2020-12, 2019-09, 07, 06, 04 and 03. Drafts 04 and 03 are considered "frozen" in that less effort is put in to backport new tests to these versions. Additional coverage is always welcome, particularly for bugs encountered in real-world implementations. If you see anything missing or incorrect, please feel free to file an issue or submit a PR. Introduction to the Test Suite StructureThe tests in this suite are contained in the The structure and contents of each file in these directories is described below. In addition to the version-specific subdirectories, two additional directories are present:
Inside each version directory there are a number of Each TerminologyFor clarity, we first define this document's usage of some testing terminology:
An example illustrating this structure is immediately below, and a JSON Schema containing a formal definition of the contents of test cases can be found alongside this README. Sample Test CaseHere is a single test case, containing one or more tests: {
"description": "The test case description",
"schema": { "type": "string" },
"tests": [
{
"description": "a test with a valid instance",
"data": "a string",
"valid": true
},
{
"description": "a test with an invalid instance",
"data": 15,
"valid": false
}
]
} Subdirectories Within Each DraftThere is currently only one additional subdirectory that may exist within each draft test directory. This is:
Note, the Using the Suite to Test a Validator ImplementationThe test suite structure was described above. If you are authoring a new validator implementation, or adding support for an additional version of the specification, this section describes:
How to Implement a Test RunnerPresented here is a possible implementation of a test runner. The precise steps described do not need to be followed exactly, but the results of your own procedure should produce the same effects. To test a specific version:
If your implementation supports multiple versions, run the above procedure for each version supported, configuring your implementation as appropriate to call each version individually. Additional Assumptions
Invariants & GuaranteesThe test suite guarantees a number of things about tests it defines. Any deviation from the below is generally considered a bug. If you suspect one, please file an issue:
Known LimitationsThis suite expresses its assertions about the behavior of an implementation within JSON Schema itself. Each test is the application of a schema to a particular instance. This means that the suite of tests can test against any behavior a schema can describe, and conversely cannot test against any behavior which a schema is incapable of representing, even if the behavior is mandated by the specification. For example, a schema can require that a string is a URI-reference and even that it matches a certain pattern, but even though the specification contains recommendations about URIs being normalized, a JSON schema cannot today represent this assertion within the core vocabularies of the specifications, so no test covers this behavior. Who Uses the Test SuiteThis suite is being used by: ClojureCoffeescriptCommon LispC++DartElixirErlangGoHaskellJava
JavaScript
Node.jsFor node.js developers, the suite is also available as an npm package. Node-specific support is maintained in a separate repository which also welcomes your contributions! .NETPerl
PHPPostgreSQLPythonRubyRustScalaSwiftIf you use it as well, please fork and send a pull request adding yourself to the list :). ContributingIf you see something missing or incorrect, a pull request is most welcome! There are some sanity checks in place for testing the test suite. You can run
them with |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论