E5C6 GitHub - pulpogato/pulpogato: Generated GitHub Java Client · GitHub
[go: up one dir, main page]

Skip to content

pulpogato/pulpogato

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,005 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pulpogato

Pulpogato is a java client for GitHub.

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

 

GitHub commits since latest release   Issues Statuses

Usage

For releases, use mavenCentral.

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

For snapshots, use this url.

https://central.sonatype.com/repository/maven-snapshots/

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 io.github.pulpogato:pulpogato-bom.

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")
}

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.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

GHES-3.16

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.15

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

GHES-3.14

Maven Central Version Maven Snapshot

Maven Central Version Maven Snapshot

EOL Versions
GitHub Version GraphQL REST

GHES-3.13

Maven Central Version

Maven Central Version

GHES-3.12

Maven Central Version

Maven Central Version

GHES-3.11

Maven Central Version

Maven Central Version

GHES-3.10

Maven Central Version

Maven Central Version

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.

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 asciidoctor/docker-asciidoctor:main and writes output to pulpogato-docs/build/index.html.

Contributors

Languages

0