(variables []*ai_api_dto.AiPromptVariable)
| 76 | } |
| 77 | |
| 78 | func 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 | |
| 94 | func genComponents() *openapi3.Components { |
| 95 | result := openapi3.NewComponents() |
no outgoing calls
no test coverage detected