Skip to content

[Schema Inaccuracy] To improve types for repos/get-content responses #165

Closed
@oscard0m

Description

@oscard0m

Schema Inaccuracy

Responses for repos/get-content operation should be more accurate.

Expected

  • The "type" property for responses in repos/get-content (content-directory, content-file, content-symlink, content-submodule) should be defined with its corresponding literal instead of accepting a type string.

  • "title" and "description" for content-submodule are wrong

content-directory: {
	title: "Content Directory",
	description: "A list of directory items",
	type: "array",
	items: {
		type: "object",
			properties: {
				type: {
					type: "string"
+					enum: ["dir"] 
			},
...

content-file: {
	title: "Content File",
	description: "Content File",
	type: "object",
	properties: {
		type: {
			type: "string"
+			enum: ["file"]
		},
...

content-symlink: {
	title: "Symlink Content",
	description: "An object describing a symlink",
	type: "object",
	properties: {
		type: {
			type: "string"
+			enum: ["symlink"]
		},
...

content-submodule: {
-	title: "Symlink Content",
+	title: "Submodule Content",
-	description: "An object describing a symlink",
+	description: "An object describing a submodule",
	type: "object",
	properties: {
		type: {
			type: "string"
+			enum: ["submodule"]
		},
...

GitHub Docs reference: https://docs.github.com/en/rest/reference/repos#get-repository-content

Reproduction Steps

Linking this issue from Octokit where this becomes a TypeScript problem: https://github.com/octokit/rest.js/issues/1971#issuecomment-759693838

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions