Files
moderne-docs/references/api-schema.md
Scott Jungling 9d8d61adcf Revert "docs: add toc to api schema docs"
This reverts commit 4897ec3e38.
2021-09-08 10:23:49 -07:00

46 KiB

Moderne.io GraphQL API

Query

Field Argument Type Description
accessTokens [AccessTokenView!]!
activeRecipeRuns [RecipeRun!]!

Get all currently active recipe runs by a user id (passed via header) sorted by most recent

limit Int
sortOrder SortOrder
category RecipeCategory!

Returns a single category with associated recipes and subCategories

categoryId ID!
findRecipes [Recipe!]!

Search for recipes by query

query String!
githubAppInstallationRepositories [GithubAppInstallationRepository!]!
installationId ID!
githubAppInstallations [GithubAppInstallation!]!
githubOrganizations [GithubOrganization!]!

Github Organizations the user belong to, includes public and private

name String

Optional name to filter user's organizations by

githubRepositories [GithubRepository!]!

Github Repositories owned by the user directly, not an organization

previousRecipeRuns [RecipeRun!]!

Get all recipe runs by a user id (passed via header) sorted by most recent

limit Int
sortOrder SortOrder
recipe Recipe!

Look up single recipe record by id \n Example: id: org.openrewrite.java.testing.junit5.IgnoreToDisabled

id ID!
recipeArtifacts [RecipeArtifact!]!

Return all loaded recipe artifacts

recipeRun RecipeRun!
id ID!
recipeRunResults RecipeRunResultsByRepository!

This query is only apart of MRE for the purposes of schema composition Queries will be handled directly by a worker.

after String
first Int
id ID!
repositoryId ID!
recipeRunResultsByRepository ResultConnection!

This query is only apart of MRE for the purposes of schema composition Queries will be handled directly by a worker.

after String
first Int
id ID!

Run ID

query String
repositoryId ID!

Example: Netflix:eureka

recipeRunSummaryByRepository RecipeRunSummary!
id ID!

Recipe Run ID

repositoryId ID!

Example: Netflix:eureka

recipes ⚠️ [Recipe!]!

Returns multiple recipes matching the list of strings provided @Deprecated -- use recipe(id) instead

⚠️ DEPRECATED

use recipe(id) instead

names [String!]!
repository Repository!

This query is only apart of MRE for the purposes of schema composition Queries will be handled directly by a worker.

id ID!
repositoryIndex [RepositoryIndexItem!]

Returns the list of known repository identifiers

worker Worker

Look up worker by name

name String!
workers [Worker!]!

Return all known workers

Mutation

Field Argument Type Description
addIngestToGithubRepository String!
installationId String!
repositoryName String!
repositoryOwner String!
cancelRecipeRun ID!
id ID!
commitToBranch BranchResponse!
branchName String!
commit String!
commitMessage String!
recipeRunId ID!
repositoryId ID!
resultsLink String!
createAccessToken String!
description String
createBranchFromResult BranchResponse!
branchName String!
commit String!
commitMessage String!
fork Boolean!
recipeRunId ID!
repositoryId ID!
resultsLink String!
deleteAccessToken Boolean!
id ID!
loadRecipes RecipeArtifact
artifactId String!
datedSnapshotVersion String
groupId String!
version String!
runRecipe RecipeRun!
run RecipeRunInput!
runYamlRecipe RecipeRun!
repositoryFilter [ID!]
yaml String!

Objects

AccessTokenView

Field Argument Type Description
created DateTime!
description String
id ID!

BranchResponse

Field Argument Type Description
branchName String!
commit String!

Commit SHA

repository GithubRepository!

Commit

Field Argument Type Description
branch String!
changeset String!

Git SHA

GithubAppInstallation

Field Argument Type Description
accountLogin String!
accountType GithubAccountType!
id ID!
repositories [GithubAppInstallationRepository!]!

GithubAppInstallationRepository

Field Argument Type Description
hasWorkflowInstalled Boolean!
isWorkflowRunInProgress Boolean!
lastWorkflowRunAt DateTime
repository GithubRepository!
wasLastWorkflowRunSuccessful Boolean

GithubOrganization

Field Argument Type Description
id ID!
name String!
repositories [GithubRepository!]!
url String!

GithubRepository

Field Argument Type Description
defaultBranch String!
fullName String!
id ID!
name String!
privateRepo Boolean!

GithubUserAccessTokenResponse

Field Argument Type Description
accessToken String!
refreshToken String!

Option

Field Argument Type Description
description String!
displayName String!
example String
name String!
required Boolean!
type String!
valid [String]
value Object

Organization

Field Argument Type Description
id ID!
name String!

Page

Field Argument Type Description
endCursor String!
hasNextPage Boolean!

Recipe

Field Argument Type Description
description String

Note: May contain markdown formatting @markdown

id ID!

Example: org.openrewrite.java.testing.junit5.IgnoreToDisabled

languages [String!]!
name String!

Note: May contain markdown formatting @markdown

options [Option!]!
recipeArtifact RecipeArtifact
recipeList [Recipe!]!
tags [String!]!
totalRecipes Int!

RecipeArtifact

Field Argument Type Description
artifactId String!
datedSnapshotVersion String
groupId String!
repositoryUrl String
requestedVersion String!
snapshotTime DateTime

The time from datedSnapshotVersion extracted into a DateTime for human readable presentation in time zones other than UTC

version String!

RecipeCategory

Field Argument Type Description
breadcrumbs [RecipeCategoryBreadcrumb!]!
description String

@markdown

id ID!
name String!

Captialization handled in services. Text transformation by client not required @markdown

recipes [Recipe!]!
subCategories [RecipeCategory!]!

Sorted alphabetically by RecipeCategory.name

tags [String!]!
totalRecipeCount Int!

RecipeCategoryBreadcrumb

Field Argument Type Description
id ID!
name String!

RecipeRun

Field Argument Type Description
id ID!
recipe Recipe!
repositoryFilter [ID!]!
start DateTime!
state RecipeRunState!
summaryResults [RecipeRunSummary!]!

Sorted alphabetically by Repository ID

RecipeRunResultsByRepository

Field Argument Type Description
commit Commit!
patchLink String
results ResultConnection!
totalResults Int!
totalSearched Int!

RecipeRunSummary

Field Argument Type Description
commit Commit!
lastUpdated DateTime!
repositoryId ID!
resultsLink String

The GraphQL endpoint that you can execute a RecipeRunResultsByRepository. When a worker is in Moderne's VPC, the API gateway serves as a redirect to the worker node.

@see https://api.moderne.io/worker/results?worker=abc123

runId ID!
state RecipeRunSummaryState!
stateMessage String
totalResults Int!
totalSearched Int!

Repository

Field Argument Type Description
commit Commit!
id ID!

Example: netflix:eureka

ingested DateTime!

Example: 2021-05-13T11:56:29.818228-07:00

javaVersion RepositoryJavaVersion
name String!

Example: eureka

organization Organization!

Example: netflix

sourceFilesByType [SourceFileTypeCount!]!

Example: {"fileType": "java", "count": 1392}

RepositoryIndexItem

Field Argument Type Description
id ID!
link String!

RepositoryJavaVersion

Field Argument Type Description
createdBy String!
sourceCompatibility String!
targetCompatibility String!
vmVendor String!

Result

Field Argument Type Description
after String!
afterSourcePath String!
before String!
beforeSourcePath String!
diff String!

ResultConnection

Field Argument Type Description
edges [ResultEdge!]!
pageInfo Page!

ResultEdge

Field Argument Type Description
cursor String!
node Result!

SourceFileTypeCount

Field Argument Type Description
count Int!

Example: 1392

fileType String!

Example: java

linesOfCode Int!

Worker

Field Argument Type Description
connectedSince DateTime!
name String!
repositories [String!]!

Inputs

OptionInput

Recipe option input value type depends on the particular recipe

Field Type Description
name String!

Example: methodPattern

value Object!

Example: java.util.List add(..)

RecipeInput

Field Type Description
id ID!

Example: org.openrewrite.java.search.FindMethods

options [OptionInput!]

RecipeRunInput

Field Type Description
recipe RecipeInput!
repositoryFilter [ID!]

Send null to run on all repositories. Example: airbnb:epoxy

Enums

ErrorDetail

Value Description
DEADLINE_EXCEEDED

The deadline expired before the operation could complete.

For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.

HTTP Mapping: 504 Gateway Timeout Error Type: UNAVAILABLE

ENHANCE_YOUR_CALM

The server detected that the client is exhibiting a behavior that might be generating excessive load.

HTTP Mapping: 429 Too Many Requests or 420 Enhance Your Calm Error Type: UNAVAILABLE

FIELD_NOT_FOUND

The requested field is not found in the schema.

This differs from NOT_FOUND in that NOT_FOUND should be used when a query is valid, but is unable to return a result (if, for example, a specific video id doesn't exist). FIELD_NOT_FOUND is intended to be returned by the server to signify that the requested field is not known to exist. This may be returned in lieu of failing the entire query. See also PERMISSION_DENIED for cases where the requested field is invalid only for the given user or class of users.

HTTP Mapping: 404 Not Found Error Type: BAD_REQUEST

INVALID_ARGUMENT

The client specified an invalid argument.

Note that this differs from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name).

HTTP Mapping: 400 Bad Request Error Type: BAD_REQUEST

INVALID_CURSOR

The provided cursor is not valid.

The most common usage for this error is when a client is paginating through a list that uses stateful cursors. In that case, the provided cursor may be expired.

HTTP Mapping: 404 Not Found Error Type: NOT_FOUND

MISSING_RESOURCE

Unable to perform operation because a required resource is missing.

Example: Client is attempting to refresh a list, but the specified list is expired. This requires an action by the client to get a new list.

If the user is simply trying GET a resource that is not found, use the NOT_FOUND error type. FAILED_PRECONDITION.MISSING_RESOURCE is to be used particularly when the user is performing an operation that requires a particular resource to exist.

HTTP Mapping: 400 Bad Request or 500 Internal Server Error Error Type: FAILED_PRECONDITION

SERVICE_ERROR

Service Error.

There is a problem with an upstream service.

This may be returned if a gateway receives an unknown error from a service or if a service is unreachable. If a request times out which waiting on a response from a service, DEADLINE_EXCEEDED may be returned instead. If a service returns a more specific error Type, the specific error Type may be returned instead.

HTTP Mapping: 502 Bad Gateway Error Type: UNAVAILABLE

TCP_FAILURE

Request failed due to network errors.

HTTP Mapping: 503 Unavailable Error Type: UNAVAILABLE

THROTTLED_CONCURRENCY

Request throttled based on server concurrency limits.

HTTP Mapping: 503 Unavailable Error Type: UNAVAILABLE

THROTTLED_CPU

Request throttled based on server CPU limits

HTTP Mapping: 503 Unavailable. Error Type: UNAVAILABLE

UNIMPLEMENTED

The operation is not implemented or is not currently supported/enabled.

HTTP Mapping: 501 Not Implemented Error Type: BAD_REQUEST

UNKNOWN

Unknown error.

This error should only be returned when no other error detail applies. If a client sees an unknown errorDetail, it will be interpreted as UNKNOWN.

HTTP Mapping: 500 Internal Server Error

ErrorType

Value Description
BAD_REQUEST

Bad Request.

There is a problem with the request. Retrying the same request is not likely to succeed. An example would be a query or argument that cannot be deserialized.

HTTP Mapping: 400 Bad Request

FAILED_PRECONDITION

The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc.

Service implementers can use the following guidelines to decide between FAILED_PRECONDITION and UNAVAILABLE:

  • Use UNAVAILABLE if the client can retry just the failing call.
  • Use FAILED_PRECONDITION if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, FAILED_PRECONDITION should be returned since the client should not retry unless the files are deleted from the directory.

HTTP Mapping: 400 Bad Request or 500 Internal Server Error

INTERNAL

Internal error.

An unexpected internal error was encountered. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors.

HTTP Mapping: 500 Internal Server Error

NOT_FOUND

The requested entity was not found.

This could apply to a resource that has never existed (e.g. bad resource id), or a resource that no longer exists (e.g. cache expired.)

Note to server developers: if a request is denied for an entire class of users, such as gradual feature rollout or undocumented allowlist, NOT_FOUND may be used. If a request is denied for some users within a class of users, such as user-based access control, PERMISSION_DENIED must be used.

HTTP Mapping: 404 Not Found

PERMISSION_DENIED

The caller does not have permission to execute the specified operation.

PERMISSION_DENIED must not be used for rejections caused by exhausting some resource or quota. PERMISSION_DENIED must not be used if the caller cannot be identified (use UNAUTHENTICATED instead for those errors).

This error Type does not imply the request is valid or the requested entity exists or satisfies other pre-conditions.

HTTP Mapping: 403 Forbidden

UNAUTHENTICATED

The request does not have valid authentication credentials.

This is intended to be returned only for routes that require authentication.

HTTP Mapping: 401 Unauthorized

UNAVAILABLE

Currently Unavailable.

The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff.

HTTP Mapping: 503 Unavailable

UNKNOWN

Unknown error.

For example, this error may be returned when an error code received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error.

If a client sees an unknown errorType, it will be interpreted as UNKNOWN. Unknown errors MUST NOT trigger any special behavior. These MAY be treated by an implementation as being equivalent to INTERNAL.

When possible, a more specific error should be provided.

HTTP Mapping: 520 Unknown Error

GithubAccountType

Value Description
Organization
User

RecipeRunState

Value Description
CANCELED
FINISHED
RUNNING

RecipeRunSummaryState

Value Description
CANCELED
CREATED
ERROR
FINISHED
LOADING
QUEUED
RUNNING
TIMEOUT
UNAVAILABLE

SortOrder

Value Description
ASC
DESC

Scalars

Boolean

The Boolean scalar type represents true or false.

DateTime

ID

The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

Int

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Object

An object scalar

String

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.