Skip to content

Commit

Permalink
include path and x_ms_path endpoints in genearted crates (#718)
Browse files Browse the repository at this point in the history
This addresses an issue where some specs split endpoints between `path`
and `x-ms-path`.  This exposes a significant number of operations across
the generated crates that were not previously included.

NOTE: this was generated using version of the REST specs, 48d85585897aa6ed448ca689b094e60377a25cb7
  • Loading branch information
bmc-msft authored Apr 20, 2022
1 parent dec13ec commit 89e9f71
Show file tree
Hide file tree
Showing 56 changed files with 184,683 additions and 49,378 deletions.
6 changes: 3 additions & 3 deletions services/autorust/codegen/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Spec {
docs.insert(Utf8PathBuf::from(file_path), doc);
for ref_file in ref_files {
let child_path = io::join(&file_path, &ref_file)?;
Spec::read_file(docs, &child_path)?;
Self::read_file(docs, &child_path)?;
}
}
Ok(())
Expand Down Expand Up @@ -239,7 +239,7 @@ impl Spec {
let mut operations: Vec<WebOperationUnresolved> = Vec::new();
for (doc_file, doc) in self.docs() {
if self.is_input_file(&doc_file) {
let paths = self.resolve_path_map(doc_file, doc.paths())?;
let paths = self.resolve_path_map(doc_file, &doc.paths())?;
for (path, item) in &paths {
operations.extend(path_operations_unresolved(doc_file, path, item))
}
Expand Down Expand Up @@ -368,7 +368,7 @@ pub mod openapi {
match item {
ReferenceOr::Reference { reference, .. } => list.push(TypedReference::PathItem(reference.clone())),
ReferenceOr::Item(item) => {
for operation in path_operations_unresolved(&doc_file, path, item) {
for operation in path_operations_unresolved(&doc_file, &path, &item) {
// parameters
for param in &operation.parameters {
match param {
Expand Down
15 changes: 10 additions & 5 deletions services/autorust/openapi/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ pub struct OpenAPI {
}

impl OpenAPI {
pub fn paths(&self) -> &IndexMap<String, ReferenceOr<PathItem>> {
if !self.x_ms_paths.is_empty() {
&self.x_ms_paths
} else {
&self.paths
pub fn paths(&self) -> IndexMap<String, ReferenceOr<PathItem>> {
let mut result = IndexMap::new();
for (k, v) in self.x_ms_paths.iter() {
result.insert(k.clone(), v.clone());
}
for (k, v) in self.paths.iter() {
if !self.x_ms_paths.contains_key(k) {
result.insert(k.clone(), v.clone());
}
}
result
}
pub fn version(&self) -> Result<&str, Error> {
Ok(self.info.version.as_ref().ok_or(Error::MissingApiVersion)?.as_str())
Expand Down
18 changes: 9 additions & 9 deletions services/mgmt/apimanagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ The default tag is `package-2021-08`.

The following [tags](https://github.com/Azure/azure-sdk-for-rust/blob/main/services/tags.md) are available:

- `package-2021-08` has 271 operations from 1 API versions: `2021-08-01`. Use crate feature `package-2021-08` to enable. The operations will be in the `package_2021_08` module.
- `package-preview-2021-04` has 271 operations from 1 API versions: `2021-04-01-preview`. Use crate feature `package-preview-2021-04` to enable. The operations will be in the `package_preview_2021_04` module.
- `package-preview-2021-01` has 258 operations from 1 API versions: `2021-01-01-preview`. Use crate feature `package-preview-2021-01` to enable. The operations will be in the `package_preview_2021_01` module.
- `package-2020-12` has 258 operations from 1 API versions: `2020-12-01`. Use crate feature `package-2020-12` to enable. The operations will be in the `package_2020_12` module.
- `package-preview-2020-06` has 258 operations from 1 API versions: `2020-06-01-preview`. Use crate feature `package-preview-2020-06` to enable. The operations will be in the `package_preview_2020_06` module.
- `package-2019-12` has 238 operations from 1 API versions: `2019-12-01`. Use crate feature `package-2019-12` to enable. The operations will be in the `package_2019_12` module.
- `package-preview-2019-12` has 228 operations from 1 API versions: `2019-12-01-preview`. Use crate feature `package-preview-2019-12` to enable. The operations will be in the `package_preview_2019_12` module.
- `package-2019-01` has 202 operations from 1 API versions: `2019-01-01`. Use crate feature `package-2019-01` to enable. The operations will be in the `package_2019_01` module.
- `package-2018-06-preview` has 204 operations from 1 API versions: `2018-06-01-preview`. Use crate feature `package-2018-06-preview` to enable. The operations will be in the `package_2018_06_preview` module.
- `package-2021-08` has 344 operations from 1 API versions: `2021-08-01`. Use crate feature `package-2021-08` to enable. The operations will be in the `package_2021_08` module.
- `package-preview-2021-04` has 344 operations from 1 API versions: `2021-04-01-preview`. Use crate feature `package-preview-2021-04` to enable. The operations will be in the `package_preview_2021_04` module.
- `package-preview-2021-01` has 331 operations from 1 API versions: `2021-01-01-preview`. Use crate feature `package-preview-2021-01` to enable. The operations will be in the `package_preview_2021_01` module.
- `package-2020-12` has 331 operations from 1 API versions: `2020-12-01`. Use crate feature `package-2020-12` to enable. The operations will be in the `package_2020_12` module.
- `package-preview-2020-06` has 331 operations from 1 API versions: `2020-06-01-preview`. Use crate feature `package-preview-2020-06` to enable. The operations will be in the `package_preview_2020_06` module.
- `package-2019-12` has 311 operations from 1 API versions: `2019-12-01`. Use crate feature `package-2019-12` to enable. The operations will be in the `package_2019_12` module.
- `package-preview-2019-12` has 301 operations from 1 API versions: `2019-12-01-preview`. Use crate feature `package-preview-2019-12` to enable. The operations will be in the `package_preview_2019_12` module.
- `package-2019-01` has 275 operations from 1 API versions: `2019-01-01`. Use crate feature `package-2019-01` to enable. The operations will be in the `package_2019_01` module.
- `package-2018-06-preview` has 277 operations from 1 API versions: `2018-06-01-preview`. Use crate feature `package-2018-06-preview` to enable. The operations will be in the `package_2018_06_preview` module.
Loading

0 comments on commit 89e9f71

Please sign in to comment.