Skip to content

Commit

Permalink
need the flags param for file uploads as well
Browse files Browse the repository at this point in the history
  • Loading branch information
wandmagic committed Oct 23, 2024
1 parent 06e0d96 commit ca519b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,25 @@ class OscalVerticle : CoroutineVerticle() {
logger.info("Handling file upload request in the background")
val body = ctx.body().asString()
logger.info("Received body: $body")

val flags = ctx.queryParam("flags")

if (body.isNotEmpty()) {
// Create a temporary file
val tempFile = Files.createTempFile(oscalDir, "upload", ".tmp")

val tempFilePath = tempFile.toAbsolutePath()
logger.info("Created temporary file: $tempFilePath")

val args = mutableListOf("validate", tempFilePath.toString(),"--show-stack-trace")
flags.forEach { flag ->
args.add(flagToParam(flag))
}
// Write the body content to the temporary file
tempFile.appendText(body)
logger.info("Wrote body content to temporary file")
logger.info(tempFilePath+" :tempfilepath");

// Use async for parallelism
val result = async {
executeCommand(listOf("validate", tempFilePath.toString(),"--show-stack-trace"))
executeCommand(args)
}.await() // Wait for the result of the async execution

logger.info("Validation result: ${result.second}")
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/webroot/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ paths:
example:
- https://raw.githubusercontent.com/GSA/fedramp-automation/refs/heads/develop/src/validations/constraints/fedramp-external-constraints.xml
- https://raw.githubusercontent.com/GSA/fedramp-automation/refs/heads/develop/src/validations/constraints/fedramp-external-constraints.xml
- in: query
name: flags
required: false
schema:
type: array
items:
type: string
enum: [disable-schema, disable-constraint]
description: URIs of metaschema extension modules to load
example: disable-schema
requestBody:
required: true
content:
Expand Down

0 comments on commit ca519b8

Please sign in to comment.