modifyOpenAPIFile() — fastapi Function Reference
Architecture documentation for the modifyOpenAPIFile() function in tutorial004.js from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD fdc6b342_6cce_7ef9_783d_2fa5bfbff7ce["modifyOpenAPIFile()"] 891af034_f4cd_0a7e_9550_f336b6490fb5["tutorial004.js"] fdc6b342_6cce_7ef9_783d_2fa5bfbff7ce -->|defined in| 891af034_f4cd_0a7e_9550_f336b6490fb5 style fdc6b342_6cce_7ef9_783d_2fa5bfbff7ce fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
docs_src/generate_clients/tutorial004.js lines 3–33
async function modifyOpenAPIFile(filePath) {
try {
const data = await fs.promises.readFile(filePath)
const openapiContent = JSON.parse(data)
const paths = openapiContent.paths
for (const pathKey of Object.keys(paths)) {
const pathData = paths[pathKey]
for (const method of Object.keys(pathData)) {
const operation = pathData[method]
if (operation.tags && operation.tags.length > 0) {
const tag = operation.tags[0]
const operationId = operation.operationId
const toRemove = `${tag}-`
if (operationId.startsWith(toRemove)) {
const newOperationId = operationId.substring(toRemove.length)
operation.operationId = newOperationId
}
}
}
}
await fs.promises.writeFile(
filePath,
JSON.stringify(openapiContent, null, 2),
)
console.log('File successfully modified')
} catch (err) {
console.error('Error:', err)
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does modifyOpenAPIFile() do?
modifyOpenAPIFile() is a function in the fastapi codebase, defined in docs_src/generate_clients/tutorial004.js.
Where is modifyOpenAPIFile() defined?
modifyOpenAPIFile() is defined in docs_src/generate_clients/tutorial004.js at line 3.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free