-
Notifications
You must be signed in to change notification settings - Fork 2
API: Build Profile by Props (imports + controls + tests) #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9d2ced1
39bff26
e355737
9af60d3
cdf2737
d421143
2bd76b8
9310392
a34181b
ffabb16
69b5dd9
f1fc759
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11704,6 +11704,69 @@ const docTemplate = `{ | |||||
| ] | ||||||
| } | ||||||
| }, | ||||||
| "/oscal/profiles/build-props": { | ||||||
| "post": { | ||||||
| "description": "Generates a Profile selecting controls from a catalog based on prop matching rules. Returns the created Profile and the matched control IDs.", | ||||||
| "consumes": [ | ||||||
| "application/json" | ||||||
| ], | ||||||
| "produces": [ | ||||||
| "application/json" | ||||||
| ], | ||||||
| "tags": [ | ||||||
| "Profile" | ||||||
| ], | ||||||
| "summary": "Build Profile by Control Props", | ||||||
| "parameters": [ | ||||||
| { | ||||||
| "description": "Prop matching request", | ||||||
| "name": "request", | ||||||
| "in": "body", | ||||||
| "required": true, | ||||||
| "schema": { | ||||||
| "$ref": "#/definitions/oscal.ProfileHandler" | ||||||
| } | ||||||
| } | ||||||
| ], | ||||||
| "responses": { | ||||||
| "201": { | ||||||
| "description": "Created", | ||||||
| "schema": { | ||||||
| "$ref": "#/definitions/handler.GenericDataResponse-oscal_ProfileHandler" | ||||||
|
||||||
| "$ref": "#/definitions/handler.GenericDataResponse-oscal_ProfileHandler" | |
| "$ref": "#/definitions/oscal.ProfileHandler" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11698,6 +11698,69 @@ | |||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| "/oscal/profiles/build-props": { | ||||||||||||||||||||||||||||||||||
| "post": { | ||||||||||||||||||||||||||||||||||
| "description": "Generates a Profile selecting controls from a catalog based on prop matching rules. Returns the created Profile and the matched control IDs.", | ||||||||||||||||||||||||||||||||||
| "consumes": [ | ||||||||||||||||||||||||||||||||||
| "application/json" | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
| "produces": [ | ||||||||||||||||||||||||||||||||||
| "application/json" | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
| "tags": [ | ||||||||||||||||||||||||||||||||||
| "Profile" | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
| "summary": "Build Profile by Control Props", | ||||||||||||||||||||||||||||||||||
| "parameters": [ | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "description": "Prop matching request", | ||||||||||||||||||||||||||||||||||
| "name": "request", | ||||||||||||||||||||||||||||||||||
| "in": "body", | ||||||||||||||||||||||||||||||||||
| "required": true, | ||||||||||||||||||||||||||||||||||
| "schema": { | ||||||||||||||||||||||||||||||||||
| "$ref": "#/definitions/oscal.ProfileHandler" | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+11720
to
+11722
|
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
| "responses": { | ||||||||||||||||||||||||||||||||||
| "201": { | ||||||||||||||||||||||||||||||||||
| "description": "Created", | ||||||||||||||||||||||||||||||||||
| "schema": { | ||||||||||||||||||||||||||||||||||
| "$ref": "#/definitions/handler.GenericDataResponse-oscal_ProfileHandler" | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| "$ref": "#/definitions/handler.GenericDataResponse-oscal_ProfileHandler" | |
| "type": "object", | |
| "properties": { | |
| "profileId": { | |
| "type": "string" | |
| }, | |
| "controlIds": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| } | |
| }, | |
| "profile": { | |
| "type": "object" | |
| } | |
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13789,6 +13789,47 @@ paths: | |||||
| summary: Get Resolved Profile | ||||||
| tags: | ||||||
| - Profile | ||||||
| /oscal/profiles/build-props: | ||||||
| post: | ||||||
| consumes: | ||||||
| - application/json | ||||||
| description: Generates a Profile selecting controls from a catalog based on | ||||||
| prop matching rules. Returns the created Profile and the matched control IDs. | ||||||
| parameters: | ||||||
| - description: Prop matching request | ||||||
| in: body | ||||||
| name: request | ||||||
| required: true | ||||||
| schema: | ||||||
| $ref: '#/definitions/oscal.ProfileHandler' | ||||||
|
||||||
| $ref: '#/definitions/oscal.ProfileHandler' | |
| $ref: '#/definitions/oscal.BuildByPropsRequest' |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 201 response schema $ref is #/definitions/handler.GenericDataResponse-oscal_ProfileHandler, which is derived from an empty oscal.ProfileHandler schema rather than the actual response payload (profileId/controlIds/profile). Define a named response type in code and regenerate swagger so the response schema matches reality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs.goembeds the generated OpenAPI template and currently references#/definitions/oscal.ProfileHandleras the request schema for/oscal/profiles/build-props, but that definition is empty. After adding named request/response structs in the handler, regenerate the swagger artifacts so this embedded template includes the correct schema refs.