io.github.pulpogato:pulpogato-graphql-ghes-3.21

GraphQL types for ghes-3.21


Keywords
api, github, hacktoberfest, java
License
Apache-2.0

Documentation

Pulpogato

Pulpogato is a java client for GitHub. Pulpogato is Spanish for Octopus-Cat.

Pulpogato logo. An octocat in the style of Pablo Picasso.

 

GitHub commits since latest release   Issues Statuses

Usage

For releases, you can use Maven Central, GitHub Packages, or JitPack.

The maven group id is io.github.pulpogato. Most maven artifact ids are pulpogato-<api-type>-<gh-version>. The api-type is one of graphql or rest. The gh-version is one of ghec,fpt, or ghes-<GHES-version>. To align versions across all Pulpogato modules, use the artifact pulpogato-bom.

Look at the demo project for a working example.

Maven Central

This would be the URL for Maven Central.

https://repo.maven.apache.org/maven2/

GitHub Packages

This would be the URL for GitHub Packages.

https://maven.pkg.github.com/pulpogato/pulpogato

Jitpack

This would be the URL for Jitpack.

https://jitpack.io/

Jitpack uses a different groupId for the artifact, though. Instead of io.github.pulpogato, you would use com.github.pulpogato.pulpogato. Also, prefix the version with v, for example v3.2.0 instead of 3.2.0.

Sonatype Snapshots

For snapshots, use this url.

https://central.sonatype.com/repository/maven-snapshots/
Example in a Gradle kotlin build script
// These properties can also be set in gradle.properties
ext {
    set("netflixDgsVersion", "9.1.2")
    set("ghVersion", "fpt")
    set("pulpogatoVersion", "2.8.0")
}

repositories {
    mavenCentral()
}

val ghVersion: String by project.ext
val pulpogatoVersion: String by project.ext
val netflixDgsVersion: String by project.ext

dependencies {
    implementation(platform("io.github.pulpogato:pulpogato-bom:${pulpogatoVersion}"))
    // Use enforcedPlatform(...) instead of platform(...) for strict version enforcement.

    implementation("io.github.pulpogato:pulpogato-rest-${ghVersion}")
    implementation("io.github.pulpogato:pulpogato-graphql-${ghVersion}")
    implementation("io.github.pulpogato:pulpogato-github-files")
    implementation("org.springframework.boot:spring-boot-starter-webflux:4.0.2")
    implementation("com.netflix.graphql.dgs:graphql-dgs-client:11.1.0")
    implementation(platform("com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:${netflixDgsVersion}"))
}

Available versions

GitHub Version GraphQL REST

FPT

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHEC

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.21

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.20

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.19

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.18

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.17

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

EOL Versions

Shared modules

Module Version

pulpogato-common

Shared types used by both REST and GraphQL modules, such as common models and utilities.

Maven Central Version Maven Snapshot

pulpogato-bom

BOM to align versions across all Pulpogato modules. It is recommended to use this BOM in your build system to ensure all Pulpogato modules are on the same version.

Maven Central Version Maven Snapshot

pulpogato-github-files

Supports parsing Actions, Workflows, and Release configuration files.

Maven Central Version Maven Snapshot

Development

Install JDK 21 first.

To build, run ./gradlew build. If you have low memory or CPU, you can customize parallelism with --max-workers.

Build performance

Laptop and PR builds are tuned for speed, so two pieces of optional work are off by default.

-Pcodegen.format=true runs Palantir Java Format over the generated sources. Formatting is cosmetic and only affects the readability of the published sources jar, so it is skipped by default and saves roughly 13-15 seconds per REST module. CI turns it on automatically when building snapshot, candidate, and final artifacts.

-Pcoverage=true enables JaCoCo. Coverage collection and its report are a CI/reporting concern, so they stay off the default critical path.

Tests run in parallel across forked JVMs (maxParallelForks), which the data-driven generated tests benefit from the most.

Automatically generated tests

When the REST schema contains examples, they are automatically converted to tests in the generated test sources directory.

Integration tests

To contribute a test for the REST API or GraphQL API:

  1. Write a test like the ones in UserApiIntegrationTest.

  2. Then set up the environment variable GITHUB_TOKEN.

  3. If you’re running a test against a GitHub Enterprise instance, set up GITHUB_HOST and GITHUB_PORT as well.

  4. Run a command like ./gradlew :pulpogato-rest-fpt:test --tests AppsApiIntegrationTest.

    GITHUB_TOKEN=$(gh auth token) \
        ./gradlew :pulpogato-rest-fpt:test --tests AppsApiIntegrationTest

    Or if you’re using GHES:

    GITHUB_TOKEN=$(gh auth token) GITHUB_HOST=ghes.example.com GITHUB_PORT=8443 \
        ./gradlew :pulpogato-rest-ghes-3.17:test --tests AppsApiIntegrationTest
  5. That generates a yaml file in src/test/resources. If it needs cleaning up for sensitive data, do so.

REST Webhook tests

To contribute a Webhook test:

  1. Capture the HTTP request from the webhook using any tool. If you’re looking at public data, something like RequestBin is useful.

  2. Clean up the data and place it in pulpogato-rest-tests/src/main/resources/webhooks/ under the right directory based on the x-github-event header.

  3. Verify the tests work.

Schema additions

GitHub’s OpenAPI schema may sometimes be incomplete or missing properties that exist in the actual API responses. Pulpogato supports extending OpenAPI documents through *.schema.json files.

Schema additions are loaded from two locations:

  1. pulpogato-common/src/main/resources/ - additions that apply to all REST modules

  2. pulpogato-rest-<version>/src/main/resources/ - additions specific to a single version

The files follow the OpenAPI 3.1.0 format and are merged additively with optional deletion markers:

  • components.schemas entries can add new schemas or new properties to existing schemas.

  • paths entries can add missing endpoint details (for example additional response media types).

  • Setting any override node to null deletes the corresponding node from the base schema.

Example: user.suspendedAt.schema.json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Additions Schema",
    "version": "1.0.0"
  },
  "components": {
    "schemas": {
      "public-user": {
        "properties": {
          "suspended_at": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "https://github.com/github/rest-api-description/issues/5667"
          }
        }
      }
    }
  },
  "paths": {}
}

This adds the suspended_at property to the public-user schema. The property will be available as suspendedAt in the generated Java code.

Asciidoctor docs

To run asciidoctor locally, run this command.

./gradlew asciidoctorDocs

This task uses the Gradle Asciidoctor plugin and writes output to pulpogato-docs/build/index.html.