podhmo / reflect-openapi

Define OpenAPI with reflect package
Apache License 2.0
3 stars 0 forks source link

mdgen, response header #175

Open podhmo opened 1 year ago

podhmo commented 1 year ago
podhmo commented 1 year ago

text/html

main.HelloHTML3 GET /hello3/{name}

with response header

name value
operationId main.HelloHTML3
endpoint GET /hello3/{name}
input Input
output string
tags main

input

// GET /hello3/{name}
type Input struct {
    name string `in:"path"`
}

output (text/html)

html with greeting message

podhmo commented 1 year ago

application/json

main.Hello POST /api/hello

name value
operationId main.Hello
endpoint POST /api/hello
input Input
output <Anonymous>
tags main

input (application/json)

// POST /api/hello
type Input struct {
    JSONBody struct {   // 
        name string
    }
}

output (application/json)

// POST /api/hello (200)
type Output200 struct { // 
    message string
}
podhmo commented 1 year ago

new text/html

name value
operationId main.HelloHTML3
endpoint GET /hello3/{name}
input Input
output Output[string] text/html
tags main
// GET /hello3 (200) text/html
type Output200 struct {
    TextBody string

    X_SOMETHING string `in:"header" header:"X-SOMETHING"`
}
podhmo commented 1 year ago

new application/json

name value
operationId main.Hello
endpoint POST /api/hello
input Input
output Output[<Anonymous>]
tags main
// POST /api/hello (200) application/json
type Output200 struct { // 
    message string
}