Skip to content

feat: Extend the project creation api in v4#766

Draft
konac-hamza wants to merge 1 commit into
openstack-experimental:mainfrom
konac-hamza:feature/v4-project-create
Draft

feat: Extend the project creation api in v4#766
konac-hamza wants to merge 1 commit into
openstack-experimental:mainfrom
konac-hamza:feature/v4-project-create

Conversation

@konac-hamza

@konac-hamza konac-hamza commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator
  • Added ProjectCreate type with an optional ProjectID field and remaining v3 project types in the api-types crate
  • Added a UUID validator that enforces UUID v4 format on incoming project ID parameters
  • All projects endpoints except create now delegate v3 routing to a public method defined in the keystone crate

@gtema gtema force-pushed the feature/v4-project-create branch from 82abb91 to 1fe84dc Compare June 9, 2026 11:51
#[cfg_attr(feature = "builder", builder(default))]
#[cfg_attr(feature = "openapi", schema(inline, additional_properties))]
#[serde(flatten)]
//pub extra: ExtraFields,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this commented line. I know it is the copy, just no sense to copy dead code over

@@ -0,0 +1,270 @@
use axum::{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a license header as in other files


// The Validator that check format of the project id if it given by user.
#[cfg(feature = "validate")]
fn validate_uuid(id: &str) -> Result<(), ValidationError> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are currently discussing this in https://review.opendev.org/c/openstack/keystone-specs/+/983440 One big problem is that we need to ensure it is a dash-less uuid. Otherwise we must reject it as bad request

///
/// Creates a project, where the project may act as a domain.
#[utoipa::path(
post,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we definitely need to add operation_id param otherwise the openapi spec clashes

setter(strip_option, into)
)
)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additional attribute ..., derive(utoipa::ToSchema), schema(as ProjectCreateV4) is necessary to separate them in the openapi


/// New project creation request.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you also need to "rename" the openapi schema with schema(as ProjectCreateRequestV4)


pub(super) fn openapi_router() -> OpenApiRouter<ServiceState> {
OpenApiRouter::new()
.routes(routes!(create::create)) // v4-specific with optional id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem with that merge is that it technically overwrites the new v3 handler. The unittest is not able to catch this you just mock the response. You would be only capable capturing this in the api tests. I would like to ask you to add explicit new tests into tests/api/src/resource/<maybe_project_v4> testing specifying the id

@konac-hamza konac-hamza marked this pull request as draft June 9, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants