const ExtensionPrefix … const ExtensionV2Schema … type OpenAPIDefinition … type ReferenceCallback … type GetOpenAPIDefinitions … type OpenAPIDefinitionGetter … type OpenAPIV3DefinitionGetter … type PathHandler … type PathHandlerByGroupVersion … type Config … type OpenAPIV3Config … type typeInfo … var schemaTypeFormatMap … // This function is a reference for converting go (or any custom type) to a simple open API type,format pair. There are // two ways to customize spec for a type. If you add it here, a type will be converted to a simple type and the type // comment (the comment that is added before type definition) will be lost. The spec will still have the property // comment. The second way is to implement OpenAPIDefinitionGetter interface. That function can customize the spec (so // the spec does not need to be simple type,format) or can even return a simple type,format (e.g. IntOrString). For simple // type formats, the benefit of adding OpenAPIDefinitionGetter interface is to keep both type and property documentation. // Example: // // type Sample struct { // ... // // port of the server // port IntOrString // ... // } // // // IntOrString documentation... // type IntOrString { ... } // // Adding IntOrString to this function: // // "port" : { // format: "string", // type: "int-or-string", // Description: "port of the server" // } // // Implement OpenAPIDefinitionGetter for IntOrString: // // "port" : { // $Ref: "#/definitions/IntOrString" // Description: "port of the server" // } // // ... // definitions: // // { // "IntOrString": { // format: "string", // type: "int-or-string", // Description: "IntOrString documentation..." // new // } // } func OpenAPITypeFormat(typeName string) (string, string) { … } // Returns the zero-value for the given type along with true if the type // could be found. func OpenAPIZeroValue(typeName string) (interface{ … } func EscapeJsonPointer(p string) string { … } func EmbedOpenAPIDefinitionIntoV2Extension(main OpenAPIDefinition, embedded OpenAPIDefinition) OpenAPIDefinition { … } // GenerateOpenAPIV3OneOfSchema generate the set of schemas that MUST be assigned to SchemaProps.OneOf func GenerateOpenAPIV3OneOfSchema(types []string) (oneOf []spec.Schema) { … }