Requirements#

JSON Requirements
status: draft
security: YES
safety: ASIL_B
version: 1

General Requirements#

JSON Deserialization
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Functional
testlink: JsonTest__ReadWriteEmptyMemberName (passed); ParserTest__CanParseObjectBool (passed); ParserTest__CanParseObjectString (passed); ParserTest__CanParseObjectNull (passed); ParserTest__CanParseObjectNumber (passed); ParserTest__CanParseObjectFloatingPointNumber (passed); ParserTest__CanParseObjectInObject (passed); ParserTest__CanParseListInObject (passed); ParserTest__CanParseObjectInObjectAndIterateOverKeys (passed); ParserTest__EmitsErrorWhenParsingObjectWithValueButNoKey (passed); ParserTest__EmitsErrorWhenParsingObjectWithBinaryValue (passed); ParserTest__EmitsErrorWhenParsingTooLargeNumber (passed); ParserTest__FromFileFail (passed); ParserTest__ParsingFromFileWorks (passed); ParserTest__CanParseEmptyMemberName (passed); JsonParserVajsonTest__CanParseObjectHexadecimalNumber (passed); JsonParserVajsonTest__CanParseTwoByteBuffer (passed); JsonParserVajsonTest__CanParseBufferWithUtf8Bom (passed); NumberTest__WhenParsingABoolStoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAUint8StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAUint16StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAUint32StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAUint64StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAInt8StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAInt16StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAInt32StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAInt64StoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingAFloatStoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); NumberTest__WhenParsingADoubleStoredInAJsonThenParsingIsSuccessfulAndCorrectValueIsReturned (passed); Number__Bool (passed); Number__Uint8 (passed); Number__Uint16 (passed); Number__Uint32 (passed); Number__Uint64 (passed); Number__Int8 (passed); Number__Int16 (passed); Number__Int32 (passed); Number__Int64 (passed); Number__Float (passed); Number__Double (passed); Number__WithDecimalPointWithoutFractionalPartCannotBeParsedAsInteger (passed); Number__WithExponentialNotationWithoutFractionalPartCannotBeParsedAsInteger (passed); Number__FloatingPointWithoutDecimalPoint (passed); Number__NearDoubleLimitsIsParsable (passed); Number__FloatingPointOverflowIsRejected (passed)
version: 1

The JSON-Library shall provide a service to deserialize JSON data according to RFC8259, i.e. parse and check for well-formedness.

Return data in user format
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Functional
version: 1

The JSON-Library shall return parsed data in a compatible user format.

Note: The user format shall be a regular type and not defined within the library.

Duplicate object member names
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Functional
testlink: ParserTest__EmitsErrorWhenParsingObjectWithDuplicateEscapedMemberName (passed); ParserTest__CanParseSameMemberNameInDifferentObjects (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/Null (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/Bool (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/Number (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/String (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/Object (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/List (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/ScalarThenObject (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/ScalarThenList (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/ObjectThenScalar (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/ListThenObject (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/NotAdjacent (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/EmptyName (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/InNestedObject (passed); ParserTest/DuplicateMemberNameTest__EmitsErrorWhenParsingObjectWithDuplicateMemberName/InObjectInList (passed)
version: 1

The JSON-Library shall reject JSON data that contains an object with two or more members of the same name with a parsing error.

Note: RFC 8259 recommends unique member names and leaves the handling of duplicates to the implementation.

User friendly API for information exchange#

Support for programming language idioms
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Non-Functional
version: 1

The public API shall support the idioms of the programming language it is written in.

Use programming language infrastructure
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Non-Functional
version: 1

The public API shall use core infrastructure of its programming language and accompanying standard libraries, whenever possible and meaningful.

Note: This includes error handling.

Enforce strict type compatibility
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Functional
version: 1

The public API shall enforce strict type compatibility. When a user requests a value, the API shall validate that the requested return type is compatible with the type and value of the stored JSON data.

Note: This includes checking if the stored value exceeds the range of the expected type.

Full testability for the user facing API#

Fully testable public API
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Non-Functional
version: 1

The public API of the library shall support dependency injection with test doubles.

Note: This enables full testability of the user code.

Safety Impact#

JSON library ASIL level
status: valid
security: YES
safety: ASIL_B
tags: baselibs, json
reqtype: Functional
version: 1

The JSON library shall be ASIL-B compliant.

AoU Requirements#

JSON data integrity
status: valid
security: NO
safety: ASIL_B
tags: baselibs, json
reqtype: Non-Functional
version: 1

The user shall provide a string as input which is not corrupted due to HW or QM SW errors.

Note: This could be achieved by using a safe read-only filesystem for JSON file storage or a checksum protection on the JSON file content.

Access control
status: valid
security: NO
safety: ASIL_B
tags: baselibs, json
reqtype: Non-Functional
version: 1

The user shall ensure access control and manipulation prevention on the JSON files.

Note: This can be done by the hosting process and system configuration (e.g. by using dm-verity).