java.lang.Object
com.arc_e_tect.gradle.apionly.transcriberj.core.Generation

public final class Generation extends Object
One generation run: a contract in, a tree of Java sources out.

The core emitter runs first; then every other emitter, in the order given, over the same model and the same class names.

  • Method Details

    • run

      public static GenerationReport run(Path contract, String contractVersion, String contractSha256, Settings settings, Path outputDirectory, List<Emitter> emitters, Path endpointIndex)
      Generates one contract's sources, replacing whatever the output directory held.
      Parameters:
      contract - the fetched contract document
      contractVersion - the version the build locked the contract at
      contractSha256 - the SHA-256 the build locked the document at
      settings - how the project asked for the classes
      outputDirectory - where the sources go
      emitters - the emitters to run after the core emitter
      endpointIndex - where to write the path of every operation class and inline schema class, keyed ClassName.PATH, for tools that read test sources without a classpath; null to write none
      Returns:
      what could not be generated in full
      Throws:
      GenerationException - when no sources can be generated from the contract
    • run

      public static GenerationReport run(Path contract, Path asyncContract, String contractVersion, String contractSha256, Settings settings, Path outputDirectory, List<Emitter> emitters, Path endpointIndex)
      Generates one contract's sources from both of its documents.

      They are read into one model, so a fragment both use -- a username in a response and in an event payload -- is one component, and one class.

      Parameters:
      contract - the fetched OpenAPI document
      asyncContract - the fetched AsyncAPI document, or null when the contract has none
      contractVersion - the version the build locked the contract at
      contractSha256 - the SHA-256 the build locked the document at
      settings - how the project asked for the classes
      outputDirectory - where the sources go
      emitters - the emitters to run after the core emitter
      endpointIndex - where to write the path of every operation class and inline schema class, keyed ClassName.PATH, for tools that read test sources without a classpath; null to write none
      Returns:
      what could not be generated in full
      Throws:
      GenerationException - when no sources can be generated from the contract