builtin

package
v0.0.0-...-52cadad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Schema = types2.APISchema{
		Schema: &schemas.Schema{
			ID:                "schema",
			PluralName:        "schemas",
			CollectionMethods: []string{"GET"},
			ResourceMethods:   []string{"GET"},
			ResourceFields: map[string]schemas.Field{
				"collectionActions": {Type: "map[json]"},
				"collectionFields":  {Type: "map[json]"},
				"collectionFilters": {Type: "map[json]"},
				"collectionMethods": {Type: "array[string]"},
				"pluralName":        {Type: "string"},
				"resourceActions":   {Type: "map[json]"},
				"attributes":        {Type: "map[json]"},
				"resourceFields":    {Type: "map[json]"},
				"resourceMethods":   {Type: "array[string]"},
				"version":           {Type: "map[json]"},
			},
		},
		Formatter: SchemaFormatter,
		Store:     schema.NewSchemaStore(),
	}

	Error = types2.APISchema{
		Schema: &schemas.Schema{
			ID:                "error",
			ResourceMethods:   []string{},
			CollectionMethods: []string{},
			ResourceFields: map[string]schemas.Field{
				"code":      {Type: "string"},
				"detail":    {Type: "string", Nullable: true},
				"message":   {Type: "string", Nullable: true},
				"fieldName": {Type: "string", Nullable: true},
				"status":    {Type: "int"},
			},
		},
	}

	Collection = types2.APISchema{
		Schema: &schemas.Schema{
			ID:                "collection",
			ResourceMethods:   []string{},
			CollectionMethods: []string{},
			ResourceFields: map[string]schemas.Field{
				"data":       {Type: "array[json]"},
				"pagination": {Type: "map[json]"},
				"sort":       {Type: "map[json]"},
				"filters":    {Type: "map[json]"},
			},
		},
	}

	Schemas = types2.EmptyAPISchemas().
			MustAddSchema(Schema).
			MustAddSchema(Error).
			MustAddSchema(Collection)
)

Functions

func SchemaFormatter

func SchemaFormatter(apiOp *types2.APIRequest, resource *types2.RawResource)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL