Interface StubGenerator<T>

    • Method Detail

      • canReadStubMapping

        default boolean canReadStubMapping​(File mapping)
        Parameters:
        mapping - - potential stub mapping mapping
        Returns:
        true if this converter could have generated this mapping stub.
      • convertContents

        Map<org.springframework.cloud.contract.spec.Contract,​String> convertContents​(String rootName,
                                                                                           org.springframework.cloud.contract.verifier.file.ContractMetadata content)
        Parameters:
        rootName - - root name of the contract
        content - - metadata of the contract
        Returns:
        the collection of converted contracts into stubs. One contract can result in multiple stubs.
      • postProcessStubMapping

        default T postProcessStubMapping​(T stubMapping,
                                         org.springframework.cloud.contract.spec.Contract contract)
        Post process a generated stub mapping.
        Parameters:
        stubMapping - - mapping of a stub
        contract - - contract for which stub was generated
        Returns:
        the converted stub mapping
      • defaultStubMappingPostProcessing

        default T defaultStubMappingPostProcessing​(T stubMapping,
                                                   org.springframework.cloud.contract.spec.Contract contract)
        Stub mapping to chose when no post processors where found on the classpath.
        Parameters:
        stubMapping - - mapping of a stub
        contract - - contract for which stub was generated
        Returns:
        the converted stub mapping
      • generateOutputFileNameForInput

        String generateOutputFileNameForInput​(String inputFileName)
        Parameters:
        inputFileName - - name of the input file
        Returns:
        the name of the converted stub file. If you have multiple contracts in a single file then a prefix will be added to the generated file. If you provide the Contract.getName() field then that field will override the generated file name. Example: name of file with 2 contracts is foo.groovy, it will be converted by the implementation to foo.json. The recursive file converter will create two files 0_foo.json and 1_foo.json
      • fileExtension

        default String fileExtension()
        Describes the file extension of the generated mapping that this stub generator can handle.
        Returns:
        string describing the file extension