Files
moderne-docs/references/api-schema.md
2021-10-02 19:07:55 +00:00

31 KiB

GraphQL API documentation

Query

Field Argument Type Description
accessTokens [AccessTokenView!]!
activeRecipeRuns [RecipeRun!]! Get all currently active recipes by a user id (passed via header); sorted by most recent.
limit Int
sortOrder SortOrder
allowedUsers [String!]!
category RecipeCategory! Returns a single category with associated `recipes` and `subCategories`.
categoryId ID!
events EventConnection!
after String
first Int
findRecipes [Recipe!]! Search for recipes matching the supplied search query.
query String!
githubApiTokenExists Boolean!
githubAppInstallationRepositories [GithubAppInstallationRepository!]!
installationId ID!
githubAppInstallations [GithubAppInstallation!]!
previousRecipeRuns RecipeRunConnection! Get all recipe runs by a user id (passed via header) sorted by most recent.
after String
first Int
sortOrder SortOrder
quarantinedRepositories [RepositoryIndexItem!]
recipe Recipe! Look up a single recipe record by it's fully-qualified `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 a part of Recipe Execution for schema composition. Queries are handled directly by a worker.
after String
first Int
id ID!
repositoryId ID!
recipeRunResultsByRepository ResultConnection! This query is only a part of Recipe Execution for schema composition Queries are 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!]! ⚠️ DEPRECATED
names [String!]!
repository Repository! This query is only a part of Recipe Execution for schema composition Queries are handled directly by a worker.
id ID!
repositoryIndex [RepositoryIndexItem!] Returns the list of known repository identifiers
sourceFilesChanged [SourceFile!]
commit String!
origin String!
userAllowed Boolean!
username String!
userHasAccessToRepository Boolean! Does the current user have access to the repositoryId?
repositoryId String!
worker Worker
name String!
workers [Worker!]! This query returns a list of all active worker nodes processing recipes.

Mutation

Field Argument Type Description
addAllowedUser Boolean!
username String!
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!
deleteAllowedUser Boolean!
username String!
deleteGitHubApiToken Boolean!
exchangeGithubAuthorizationCode Boolean! Exchanges a GitHub OAuth access code into an access token. Successful exchanged tokens are stored for future use. @see https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#web-application-flow
code String! Temporary code returned from GitHub from Step 1 of the OAuth web application flow.
redirectUri String! Valid redirect URI for the associated GitHub OAuth app.
loadRecipes RecipeArtifact
artifactId String!
datedSnapshotVersion String
groupId String!
version String!
quarantineRepository Repository When a repository routinely errors or causes instability, it can be quarantined, making it effectively invisible to the service until it is un-quarantined
id ID!
runAdHocPolyglotRecipe RecipeRun!
input AdHocRecipeRunInput!
runRecipe RecipeRun!
run RecipeRunInput!
runYamlRecipe RecipeRun!
repositoryFilter [ID!]
yaml Base64!
unquarantineRepository Repository
id ID!

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

Event

Field Argument Type Description
action String!
actionType ActionType!
description String!
target String!
timestamp DateTime!
userId String!

EventConnection

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

EventEdge

Field Argument Type Description
cursor String!
node Event!

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!

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!

PageInfo

Pagination Type - Generic

Field Argument Type Description
endCursor String
hasNextPage Boolean!
hasPreviousPage Boolean!
startCursor String

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! Services handle capitalization of `name`. Clients are responsible for parsing and formatting Markdown to HTML @markdown
recipes [Recipe!]!
subCategories [RecipeCategory!]! Categories are 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

RecipeRunConnection

Pagination Types - Recipe Run History

Field Argument Type Description
edges [RecipeRunEdge]
pageInfo PageInfo

RecipeRunEdge

Field Argument Type Description
cursor String
node RecipeRun

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 redirects to the worker node. @see https://api.moderne.io/worker/results?worker=abc123
runId ID!
state RecipeRunSummaryState!
stateMessage String
timeSavings Duration
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!]!

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

Pagination Types - Results

Field Argument Type Description
edges [ResultEdge]
pageInfo PageInfo

ResultEdge

Field Argument Type Description
cursor String!
node Result!

SourceFile

Field Argument Type Description
source Base64!
sourcePath Path!

SourceFileTypeCount

Field Argument Type Description
count Int! `count` represents the number of files of this type.
fileType String! Example: `java`
linesOfCode Int! Cumulative count of lines across all the files of this type.

Worker

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

Inputs

AdHocRecipeInput

Field Type Description
id ID!
name String!
options [OptionInput!]
source Base64!
sourceName String!
sourcePath String!

AdHocRecipeRunInput

Field Type Description
partialRepository PartialRepositoryInput
recipe AdHocRecipeInput!
repositoryFilter [ID!] Send `null` to run on all repositories. Example: `airbnb:epoxy`

CommitInput

Field Type Description
branch String!
changeset String! Git SHA
origin String! SSH or HTTPS URL to the repository

OptionInput

Field Type Description
name String! Example: `methodPattern`
value Object! Example: `java.util.List add(..)`

PartialRepositoryInput

Field Type Description
commit CommitInput!
id String!
sourceFiles [SourceFileInput!]!

RecipeInput

Field Type Description
id ID! Example: `org.openrewrite.java.search.FindMethods`
options [OptionInput!]

RecipeRunInput

Field Type Description
partialRepository PartialRepositoryInput
recipe RecipeInput!
repositoryFilter [ID!] Send `null` to run on all repositories. Example: `airbnb:epoxy`

SourceFileInput

Field Type Description
source Base64!
sourcePath Path!

Enums

ActionType

Value Description
Create
Delete
Read
Update

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 A worker was unable to process this recipe.
FINISHED
LOADING A repository's Abstract Syntax Tree is loading into a worker.
QUEUED A repository is waiting for open workers to process the recipe.
RUNNING
TIMEOUT A worker was unable to process this recipe in a reasonable amount of time.
UNAVAILABLE A worker was unavailable to process this recipe.

SortOrder

Value Description
ASC
DESC

Scalars

Base64

Boolean

The Boolean scalar type represents true or false.

DateTime

Duration

String in ISO-8601. Example: PT10S -> 10 seconds

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

Path

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.