JSONFixtureFactory

public protocol JSONFixtureFactory : FixtureFactory, JSONFixtureMaker

This protocol defines the rules to create a JSON Object from an object.

  • The default JSON model definition.

    Declaration

    Swift

    func jsonDefinition() -> JSONFixtureDefinition<Model>
  • defineJSON(_:_:) Extension method

    Create a new JSON model fixture definition.

    Declaration

    Swift

    public func defineJSON(
        _ modelDefinition: FixtureDefinition<Model>? = nil,
        _ JSONDefinition: @escaping (Model) -> [String: Any]
    ) -> JSONFixtureDefinition<Model>

    Parameters

    modelDefinition

    the model definition to use for the JSON definition.

    definition

    the JSON definition closure.

    Return Value

    a new JSON model fixture definition.

  • redefine(_:) Extension method

    Edit the default JSON fixture definition.

    Declaration

    Swift

    public func redefine(_ redefinition: @escaping (Model) -> Model) -> JSONFixtureDefinition<Model>

    Parameters

    redefinition

    the redefinition closure.

    Return Value

    a new JSON model fixture definition with the specified edits.

JSONFixtureMaker

  • makeJSON(_:) Extension method

    Declaration

    Swift

    public func makeJSON(_ number: Int) -> [[String : Any]]
  • makeJSON(from:) Extension method

    Declaration

    Swift

    public func makeJSON<S>(from objects: S) -> [[String : Any]] where S : Sequence, Self.Model == S.Element
  • makeWithJSON(_:) Extension method

    Declaration

    Swift

    public func makeWithJSON(_ number: Int) -> [(object: Model, JSON: [String : Any])]