MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / genVariableSchema

Function genVariableSchema

module/ai-api/schema.go:78–92  ·  view source on GitHub ↗
(variables []*ai_api_dto.AiPromptVariable)

Source from the content-addressed store, hash-verified

76}
77
78func genVariableSchema(variables []*ai_api_dto.AiPromptVariable) *openapi3.Schema {
79 variableSchema := openapi3.NewObjectSchema()
80 required := make([]string, 0, len(variables))
81 for _, v := range variables {
82 val := openapi3.NewStringSchema()
83 val.Example = ""
84 val.Description = v.Description
85 if v.Require {
86 required = append(required, v.Key)
87 }
88 variableSchema.WithProperty(v.Key, val)
89 }
90 variableSchema.WithRequired(required)
91 return variableSchema
92}
93
94func genComponents() *openapi3.Components {
95 result := openapi3.NewComponents()

Callers 1

genRequestBodySchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected