Skip to content

Instantly share code, notes, and snippets.

@gcatanese
Last active November 28, 2022 17:50
Show Gist options
  • Save gcatanese/41898d428e9470cfc5a6e139bf4e84d0 to your computer and use it in GitHub Desktop.
Save gcatanese/41898d428e9470cfc5a6e139bf4e84d0 to your computer and use it in GitHub Desktop.
OpenAPI Generator variables available to Mustache templates (https://openapi-generator.tech/docs/templating/)
{
"openapi" : "3.0.0",
"info" : {
"contact" : {
"email" : "...",
"name" : "...",
"url" : "..."
},
"description" : "...",
"license" : {
"name" : "...",
"url" : "..."
},
"title" : "...",
"version" : "..."
},
"servers" : [ {
"description" : "...",
"url" : "..."
} ],
"tags" : [ {
"description" : "...",
"name" : "..."
} ],
"paths" : {
"/users/{userId}" : {
"get" : {
"summary" : "Get User summary",
"description" : "GET User description",
"operationId" : "get-users-userId",
"parameters" : [ {
"description" : "...",
"explode" : false,
"in" : "path",
"name" : "userId",
"required" : true,
"schema" : {
"type" : "integer"
},
"style" : "simple"
} ],
"responses" : {
"200" : {
"content" : {
"application/json" : {
"examples" : {
"Example name" : {
"value" : {
"id" : 100,
"firstName" : "...",
"lastName" : "...",
"email" : "..."
}
}
},
"schema" : {
"$ref" : "#/components/schemas/User"
}
}
},
"description" : "User Found"
},
"404" : {
"description" : "User Not Found"
}
},
"tags" : [ "..." ]
},
"patch" : {
"summary" : "Update User summary",
"description" : "Update User description",
"operationId" : "patch-users-userId",
"parameters" : [ {
"description" : "Id of an existing user.",
"explode" : false,
"in" : "path",
"name" : "userId",
"required" : true,
"schema" : {
"type" : "integer"
},
"style" : "simple"
} ],
"requestBody" : {
"content" : {
"application/json" : {
"examples" : {
"Update First Name" : {
"value" : {
"firstName" : "..."
}
},
"Update Email" : {
"value" : {
"email" : "..."
}
},
"Update Last Name & Date of Birth" : {
"value" : {
"lastName" : "...",
"dateOfBirth" : "..."
}
}
},
"schema" : {
"properties" : {
"firstName" : {
"type" : "string"
},
"lastName" : {
"type" : "string"
},
"email" : {
"description" : "Email of the user",
"type" : "string"
},
"dateOfBirth" : {
"type" : "string"
}
},
"type" : "object"
}
}
},
"description" : "Patch user properties to update."
},
"responses" : {
"200" : {
"content" : {
"application/json" : {
"examples" : {
"Updated User" : {
"value" : {
"id" : 100,
"firstName" : "...",
"lastName" : "...",
"email" : "..."
}
}
},
"schema" : {
"$ref" : "#/components/schemas/User"
}
}
},
"description" : "User Updated"
},
"404" : {
"description" : "User Not Found"
},
"409" : {
"description" : "Email Already Taken"
}
}
}
},
"components" : {
"schemas" : {
"User" : {
"description" : "",
"properties" : {
"id" : {
"description" : "Unique identifier for the given user.",
"type" : "integer"
},
"firstName" : {
"type" : "string"
},
"lastName" : {
"type" : "string"
},
"email" : {
"format" : "email",
"type" : "string"
},
"dateOfBirth" : {
"example" : "1997-10-31",
"format" : "date",
"type" : "string"
},
"emailVerified" : {
"description" : "Set to true if the user's email has been verified.",
"type" : "boolean"
},
"createDate" : {
"description" : "The date that the user was created.",
"format" : "date",
"type" : "string"
}
},
"required" : [ "email", "firstName", "id", "lastName" ],
"title" : "User",
"type" : "object",
"x-examples" : {
"Alice Smith" : {
"id" : 100,
"firstName" : "...",
"lastName" : "...",
"email" : "...",
"dateOfBirth" : "..."
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment