1
0
mirror of synced 2025-12-31 06:02:42 -05:00
Files
docs/src/github-apps/scripts/permission-list-schema.js
Rachael Sewell cb37f22ef0 automate github apps docs (#35530)
Co-authored-by: Sarah Edwards <skedwards88@github.com>
2023-06-16 19:23:05 +00:00

56 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
// This schema is used to validate
// src/github-apps/data/fine-grained-pat-permissions.json
// and src/github-apps/data/server-to-server-permissions.json
const permissionObjects = {
type: 'object',
required: ['access', 'category', 'subcategory', 'slug', 'verb', 'requestPath'],
properties: {
access: {
type: 'string',
enum: ['read', 'write', 'admin'],
},
category: {
type: 'string',
},
subcategory: {
type: 'string',
},
slug: {
type: 'string',
},
verb: {
type: 'string',
enum: ['get', 'patch', 'post', 'put', 'delete'],
},
requestPath: {
type: 'string',
},
'additional-permissions': {
type: 'array',
},
},
}
export default {
type: 'object',
required: ['title', 'displayTitle', 'permissions'],
properties: {
// Properties from the source OpenAPI schema that this module depends on
title: {
description: 'The name of the permission.',
type: 'string',
},
displayTitle: {
description: 'The display title, which includes the resource group and permission name',
type: 'string',
},
permissions: {
description: 'An oject with keys for read and write, each with an array of objects.',
type: 'array',
items: permissionObjects,
},
},
}