feat(import): complete OpenAPI onboarding and verify delivery
This commit is contained in:
1 parent
bb3e376767
commit
e93de7015a
244 files changed
+57020
-5139
No files matched your search
@@ -1,7 +1,7 @@
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::rest::{
|
||||
model::{ImportFinding, RestImportParameter, RestParameterLocation, SourceLocation},
|
||||
model::{ImportFinding, RestImportParameter, SourceLocation},
|
||||
recommendations::{document_blocker, operation_finding},
|
||||
};
|
||||
|
||||
@@ -175,33 +175,9 @@ pub(super) fn legacy_operation(path: &str, operation: &Value) -> Vec<ImportFindi
|
||||
pub(super) fn path_parameters(
|
||||
path: &str,
|
||||
parameters: &[RestImportParameter],
|
||||
operation_pointer: &str,
|
||||
) -> Vec<(ImportFinding, SourceLocation)> {
|
||||
parameters
|
||||
.iter()
|
||||
.filter(|parameter| parameter.location == RestParameterLocation::Path)
|
||||
.filter_map(|parameter| {
|
||||
let finding = if !parameter.required {
|
||||
Some((
|
||||
"path_parameter_not_required",
|
||||
format!("Path parameter {} должен быть required.", parameter.name),
|
||||
))
|
||||
} else if !path.contains(&format!("{{{}}}", parameter.name)) {
|
||||
Some((
|
||||
"path_parameter_placeholder_missing",
|
||||
format!(
|
||||
"Path parameter {} не имеет placeholder в пути.",
|
||||
parameter.name
|
||||
),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}?;
|
||||
Some((
|
||||
document_blocker(finding.0, finding.1),
|
||||
parameter.source_location.clone(),
|
||||
))
|
||||
})
|
||||
.collect()
|
||||
super::openapi3_findings::path_parameters(path, parameters, operation_pointer)
|
||||
}
|
||||
|
||||
pub(super) fn unsupported_methods(path_item: &Value) -> Vec<&str> {
|
||||
|
||||
Reference in new issue
Block a user