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
@@ -299,6 +299,17 @@ pub(super) fn schema_findings(
|
||||
pointer: &str,
|
||||
findings: &mut Vec<(ImportFinding, SourceLocation)>,
|
||||
) {
|
||||
if schema
|
||||
.get("default")
|
||||
.is_some_and(|value| value.is_object() || value.is_array())
|
||||
{
|
||||
push(
|
||||
findings,
|
||||
"unsupported_compound_default",
|
||||
"Object и array schema defaults не поддерживаются executable import contract.",
|
||||
&format!("{pointer}/default"),
|
||||
);
|
||||
}
|
||||
if let Some(types) = schema.get("type").and_then(Value::as_array) {
|
||||
let concrete = types
|
||||
.iter()
|
||||
@@ -389,8 +400,9 @@ pub(super) fn schema_findings(
|
||||
pub(super) fn path_parameters(
|
||||
path: &str,
|
||||
parameters: &[RestImportParameter],
|
||||
operation_pointer: &str,
|
||||
) -> Vec<(ImportFinding, SourceLocation)> {
|
||||
parameters
|
||||
let mut findings = parameters
|
||||
.iter()
|
||||
.filter(|parameter| parameter.location == RestParameterLocation::Path)
|
||||
.filter_map(|parameter| {
|
||||
@@ -415,7 +427,39 @@ pub(super) fn path_parameters(
|
||||
parameter.source_location.clone(),
|
||||
))
|
||||
})
|
||||
.collect()
|
||||
.collect::<Vec<_>>();
|
||||
for name in path_placeholders(path) {
|
||||
if !parameters.iter().any(|parameter| {
|
||||
parameter.location == RestParameterLocation::Path && parameter.name == name
|
||||
}) {
|
||||
findings.push((
|
||||
document_blocker(
|
||||
"path_parameter_not_declared",
|
||||
format!("Path placeholder {name} не объявлен как path parameter."),
|
||||
),
|
||||
SourceLocation {
|
||||
pointer: operation_pointer.to_owned(),
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
findings
|
||||
}
|
||||
|
||||
fn path_placeholders(path: &str) -> Vec<String> {
|
||||
let mut placeholders = Vec::new();
|
||||
let mut remaining = path;
|
||||
while let Some(open) = remaining.find('{') {
|
||||
let after_open = &remaining[open + 1..];
|
||||
let Some(close) = after_open.find('}') else {
|
||||
break;
|
||||
};
|
||||
if close > 0 {
|
||||
placeholders.push(after_open[..close].to_owned());
|
||||
}
|
||||
remaining = &after_open[close + 1..];
|
||||
}
|
||||
placeholders
|
||||
}
|
||||
|
||||
pub(super) fn unsupported_methods(path_item: &Value) -> Vec<&str> {
|
||||
|
||||
Reference in new issue
Block a user