-
Notifications
You must be signed in to change notification settings - Fork 254
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
feat(common): Add utoipa attribute macro types #1924
base: main
Are you sure you want to change the base?
Conversation
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.
PR Summary
This PR adds OpenAPI schema generation capabilities by implementing the utoipa::ToSchema
derive macro across multiple common types and models in the Shuttle platform.
- Changed response body type in
backends/src/metrics.rs
fromBoxBody
toUnsyncBoxBody<bytes::Bytes, axum::Error>
, which may impact response processing - Missing
ToSchema
derive macro onDeleteCertificateRequest
incommon/src/certificate.rs
while other similar structs have it added - Added
utoipa
crate v5 withchrono
feature as a non-optional dependency incommon/Cargo.toml
, affecting all builds regardless of feature flags
💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!
9 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
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.
PR Summary
(updates since last review)
Based on the provided information, I'll summarize the key changes in this PR, focusing only on new changes not mentioned in the previous review:
Added utoipa types for OpenAPI schema generation in the Shuttle platform's control layer:
- Updated MSRV from 1.78.0 to 1.81.0 in
.circleci/config.yml
to support new utoipa features - Added utoipa v5 with chrono feature for OpenAPI schema generation in
common/src/lib.rs
- Changed Docker image version to
cimg/rust:1.81.0
for CI builds
Note: I've kept this summary brief and focused only on the most recent changes not covered in the previous review, as requested.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
5867939
to
fccaf8b
Compare
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.
PR Summary
Based on the provided information, I'll summarize the key changes in this PR, focusing only on new changes not mentioned in the previous reviews:
Added OpenAPI schema generation support in the Shuttle platform's models:
- Added
ToSchema
derive macro to deployment-related types incommon/src/models/deployment.rs
includingDeploymentRequestBeta
andBuildArgsBeta
- Inconsistent
ToSchema
derive placement incommon/src/models/user.rs
whereAccountTier
has it after other attributes - Missing
ToSchema
derive on core resource types incommon/src/resource.rs
likeProvisionResourceRequest
andShuttleResourceOutput<T>
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, as requested.
10 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
fccaf8b
to
0c9cd22
Compare
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.
PR Summary
Based on the provided information, I'll summarize only the new changes not mentioned in previous reviews:
Added OpenAPI schema generation support in the Shuttle platform's models:
- Added
ToSchema
derive macro to project-related types incommon/src/models/project.rs
forProjectResponseBeta
andProjectListResponseBeta
- Added
ToSchema
to logging types incommon/src/log.rs
forLogItemBeta
andLogsResponseBeta
- Added
ToSchema
to certificate types incommon/src/certificate.rs
forAddCertificateRequest
andCertificateResponse
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, as requested.
9 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
0c9cd22
to
debd5a4
Compare
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.
PR Summary
Based on the provided information, I'll summarize only the new changes not mentioned in previous reviews:
Added OpenAPI schema generation support in the Shuttle platform:
- Added
typeshare::typeshare
attribute to certificate types incommon/src/certificate.rs
for cross-language type sharing - Added
typeshare::typeshare
to deployment state types incommon/src/deployment.rs
forDeploymentStateBeta
- Updated rust-version to "1.78" in
common/Cargo.toml
as the base MSRV for Shuttle crates
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, as requested.
9 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
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.
PR Summary
(updates since last review)
Based on the provided information, I'll summarize only the new changes not mentioned in previous reviews:
Increased test stability in permit integration tests:
- Doubled sleep duration after team creation in
backends/tests/integration/permit_tests.rs
fromSLEEP
toSLEEP * 2
to fix race condition - Added
DatabaseInfoBeta
struct incommon/src/lib.rs
withtypeshare::typeshare
attribute for cross-language type sharing - Added
ToSchema
derive to database types incommon/src/lib.rs
for OpenAPI schema generation
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, as requested.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
04c5fda
to
aa7bd7a
Compare
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.
PR Summary
(updates since last review)
Based on the provided information, I'll summarize the latest changes not mentioned in previous reviews:
Further increased test stability in permit integration tests:
- Increased sleep duration after team creation in
backends/tests/integration/permit_tests.rs
fromSLEEP * 2
toSLEEP * 4
(2000ms) to address race conditions - Added
DatabaseInfoBeta
Debug implementation incommon/src/lib.rs
to prevent password leakage in debug output - Added
ToSchema
derive toDatabaseInfoBeta
struct for OpenAPI schema generation
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, as requested.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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 permit test is failing on other branches, so no need to fix it here and now
aa7bd7a
to
cdfb197
Compare
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.
PR Summary
(updates since last review)
Based on the provided information, I'll summarize only the most recent changes not mentioned in previous reviews:
Added OpenAPI schema generation support in the Shuttle platform:
- Updated MSRV from 1.78 to 1.81 in
common/Cargo.toml
to support new utoipa features - Added
utoipa
v5 with chrono feature as a non-optional dependency incommon/Cargo.toml
- Removed permit test stability changes as they're being addressed in another branch
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, as requested.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
28e195d
to
830fbd1
Compare
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.
PR Summary
(updates since last review)
Based on the recent changes not mentioned in previous reviews, here's a focused summary of the key updates:
Made utoipa an optional dependency with feature flag support:
- Changed utoipa to be an optional dependency in
common/Cargo.toml
withversion = "5", features = ["chrono"]
- Added conditional
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
across model structs - Removed direct utoipa imports in favor of feature-gated usage
Note: I've kept this summary brief and focused only on the most recent changes not covered in previous reviews, highlighting just the most important aspects of making utoipa optional.
8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
PR Summary
(updates since last review)
Based on the recent changes not mentioned in previous reviews, here's a focused summary:
Made utoipa integration more robust with feature flag improvements:
- Added
utoipa
feature flag tocommon/Cargo.toml
to control schema generation - Consistently applied conditional
cfg_attr
forToSchema
across all model types - Ensured
DeleteCertificateRequest
incertificate.rs
has proper schema generation support
8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
PR Summary
(updates since last review)
Based on the provided files and previous reviews, I'll focus on the most recent changes not yet mentioned:
Added OpenAPI schema generation support with improved type sharing:
- Added
typeshare::typeshare
toDatabaseInfoBeta
incommon/src/lib.rs
for consistent cross-language type definitions - Added
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
toCertificateListResponse
incommon/src/certificate.rs
- Improved feature flag organization in
common/Cargo.toml
by grouping utoipa with related optional dependencies
Note: This summary focuses only on the latest changes not covered in previous reviews, maintaining brevity and specificity.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
d81ddcb
to
3c9da99
Compare
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.
PR Summary
(updates since last review)
Based on the recent changes not mentioned in previous reviews, here's a focused summary:
Enhanced OpenAPI schema generation with improved security and type handling:
- Added conditional
ToSchema
derive toSecret<T>
incommon/src/secrets.rs
with careful consideration for sensitive data exposure - Ensured consistent feature flag usage across all model types with
cfg_attr(feature = "utoipa")
- Added proper schema generation support for resource-related types in
common/src/resource.rs
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, highlighting just the key security and consistency improvements.
9 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
3c9da99
to
dabc0da
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary:
Added OpenAPI schema generation with improved type consistency:
- Added
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
toResourceTypeBeta
incommon/src/resource.rs
for consistent API documentation - Improved feature flag handling in
common/src/models/user.rs
by placingToSchema
derive before other attributes - Added missing format metadata for date-time fields in
CertificateResponse
for better OpenAPI schema accuracy
Note: I've focused only on the most recent changes not covered in previous reviews, keeping it concise and specific to 3 points as requested.
11 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -74,6 +75,7 @@ service = ["chrono/serde", "display", "tracing", "tracing-subscriber", "uuid"] | |||
test-utils = ["wiremock"] | |||
tonic = ["dep:tonic"] | |||
tracing = ["dep:tracing"] | |||
utoipa = ["dep:utoipa"] |
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.
logic: utoipa feature only enables the dependency but doesn't include chrono feature which may be needed for the chrono integration
763f3f3
to
557167c
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type definitions:
- Added
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
toLogsResponseBeta
incommon/src/log.rs
for consistent API documentation - Added
typeshare::typeshare
attribute toDeploymentStateBeta
incommon/src/deployment.rs
for cross-language type sharing - Updated MSRV to 1.81.0 in
.circleci/config.yml
to support new utoipa features
Note: I've focused only on the most recent changes not covered in previous reviews, keeping it concise and specific to 3 points as requested.
11 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile
#[serde(tag = "type", content = "content")] | ||
#[typeshare::typeshare] |
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.
style: The serde tag/content attributes should be documented in the OpenAPI schema to make the serialization format clear to API consumers.
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] | ||
pub struct Secret<T: Zeroize>(T); |
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.
logic: Ensure utoipa schema generation does not expose sensitive data in API docs. Consider adding schema customization to mask/redact the inner value.
41db531
to
4fbc7f2
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type handling:
- Added
ToSchema
derive toProjectUpdateRequestBeta
incommon/src/models/project.rs
for consistent API documentation - Added proper schema generation for
ProvisionResourceRequest
incommon/src/resource.rs
with feature-gated attributes - Improved security handling in
common/src/secrets.rs
by ensuringSecret<T>
schema generation respects redaction
Note: I've focused only on the most recent changes not covered in previous reviews, keeping it concise and specific to 3 points as requested.
11 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -318,6 +324,7 @@ pub enum BuildArgsBeta { | |||
} | |||
|
|||
#[derive(Deserialize, Serialize)] | |||
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] | |||
#[typeshare::typeshare] | |||
pub struct BuildArgsRustBeta { | |||
/// Version of shuttle-runtime used by this crate |
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.
style: These fields should have example values in their doc comments to help API consumers understand the expected format.
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type definitions:
- Added
ToSchema
derive toComputeTier
incommon/src/models/project.rs
for consistent API schema generation - Added proper schema generation for
BuildMetaBeta
incommon/src/models/deployment.rs
with Git metadata support - Added
ToSchema
derive toSubscriptionType
incommon/src/models/user.rs
for API documentation completeness
Note: I've focused only on the most recent changes not covered in previous reviews, keeping it concise and specific to 3 points as requested.
11 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -6,7 +6,7 @@ license.workspace = true | |||
repository.workspace = true | |||
description = "Common library for the shuttle platform (https://www.shuttle.rs/)" | |||
# Base MSRV for the Shuttle crates. If some other crate has a higher MSRV, set it in that crate. | |||
rust-version = "1.78" | |||
rust-version = "1.81" |
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.
logic: rust-version was decreased from 1.78 to 1.81 - this appears to be a typo since 1.81 is lower than 1.78
4fbc7f2
to
b658ac4
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type handling:
- Added
ToSchema
derive toDeploymentRequestImageBeta
incommon/src/models/deployment.rs
for container image request documentation - Added proper schema generation for
ResourceListResponseBeta
incommon/src/resource.rs
for consistent API responses - Added
ToSchema
derive toSecretStore
incommon/src/secrets.rs
for secure secrets management documentation
Note: I've focused only on the most recent changes not covered in previous reviews, keeping it concise and specific to 3 points as requested.
11 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
e7c37ad
to
5c1a2d6
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type consistency:
- Added
ToSchema
derive toBackend
enum incommon/src/log.rs
for complete logging system documentation - Added proper schema generation for
DeploymentRequestBuildArchiveBeta
incommon/src/models/deployment.rs
with build configuration support - Improved attribute placement consistency in
common/src/models/user.rs
by standardizingToSchema
derive order
Note: I've focused only on the most recent changes not covered in previous reviews, keeping it concise and specific to 3 points as requested.
11 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
PR Summary
Error: Error in underlying LLM call. Please try again.
10 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
5c1a2d6
to
abeef05
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type definitions:
- Added
ToSchema
derive toLogsRange
enum incommon/src/log.rs
for complete API documentation of log filtering options - Added proper schema generation for
BuildArgsRustBeta
incommon/src/models/deployment.rs
with Rust-specific build configuration support - Added missing
ToSchema
derive toDeleteCertificateRequest
incommon/src/certificate.rs
for API consistency
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, maintaining brevity and specificity with exactly 3 points as requested.
10 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] | ||
#[typeshare::typeshare] |
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.
style: Consider adding OpenAPI description attributes to document the purpose of this response type for API consumers
abeef05
to
c9dd6a5
Compare
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.
PR Summary
Based on the recent changes not mentioned in previous reviews, I'll provide a focused summary of the latest updates:
Enhanced OpenAPI schema generation with improved type handling:
- Added
ToSchema
derive toResourceInput
andResourceInputBeta
incommon/src/resource.rs
for proper deserialization documentation - Added proper schema generation for
ShuttleResourceOutput<T>
incommon/src/resource.rs
with generic type support - Added
ToSchema
derive toAccountTier
incommon/src/models/user.rs
with proper serialization attributes
Note: I've kept this summary focused only on the most recent changes not covered in previous reviews, maintaining brevity and specificity with exactly 3 points as requested.
10 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
Description of change
Adds utoipa types for the control layer in the new platform.
Used so that we can generate openapi types from code.
How has this been tested? (if applicable)