(blocks []*configBlock, blockName, fieldName string)
| 282 | } |
| 283 | |
| 284 | func generateBlockMarkdown(blocks []*configBlock, blockName, fieldName string) string { |
| 285 | // Look for the requested block. |
| 286 | for _, block := range blocks { |
| 287 | if block.name != blockName { |
| 288 | continue |
| 289 | } |
| 290 | |
| 291 | md := &markdownWriter{} |
| 292 | |
| 293 | // Wrap the root block with another block, so that we can show the name of the |
| 294 | // root field containing the block specs. |
| 295 | md.writeConfigBlock(&configBlock{ |
| 296 | name: blockName, |
| 297 | desc: block.desc, |
| 298 | entries: []*configEntry{ |
| 299 | { |
| 300 | kind: "block", |
| 301 | name: fieldName, |
| 302 | required: true, |
| 303 | block: block, |
| 304 | blockDesc: "", |
| 305 | root: false, |
| 306 | }, |
| 307 | }, |
| 308 | }) |
| 309 | |
| 310 | return md.string() |
| 311 | } |
| 312 | |
| 313 | // If the block has not been found, we return an empty string. |
| 314 | return "" |
| 315 | } |
| 316 | |
| 317 | func generateJSONSchemaMain(outputFile string) { |
| 318 | // Create a Cortex config instance |
no test coverage detected