Feat/api reference curl examples (#720)
* curl reference initial * add tooltips to curl command * refactor copy component * move copy to copy component * formatting * always include required fields * add example values * format svg * fix property extraction * explainer comment
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
export const formatMethodParams = method => {
|
||||
export const formatMethodParams = (method) => {
|
||||
const { parameters, requestBody } = method
|
||||
|
||||
const params = []
|
||||
const body = []
|
||||
if (parameters && parameters.length > 0) {
|
||||
parameters.map(p => {
|
||||
parameters.map((p) => {
|
||||
return params.push({
|
||||
property: p.name,
|
||||
description: p.description,
|
||||
@@ -14,16 +15,16 @@ export const formatMethodParams = method => {
|
||||
}
|
||||
if (requestBody) {
|
||||
const { required, properties } = requestBody
|
||||
properties.map(p => {
|
||||
return params.push({
|
||||
properties.map((p) => {
|
||||
return body.push({
|
||||
property: p.property,
|
||||
description: p.description,
|
||||
required: required ? required.some(req => req === p.property) : false,
|
||||
required: required ? required.some((req) => req === p.property) : false,
|
||||
type: p.type,
|
||||
nestedModel: p.nestedModel,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return { properties: params }
|
||||
return { properties: params, body }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user