GithubHelp home page GithubHelp logo

Comments (10)

johnbatty avatar johnbatty commented on June 24, 2024 1

Thanks very much for the detailed report!

For Case 2, as you suggest the issue is that the existing code treats Run::finishedDate as a required field. This was actually due to configuration in my spec patcher to try and eliminate some of the Option wrappers in returned structs. See here for more details. It had worked in my previous testing, but that was just because I hadn't tested with an InProgress run!
#6

I managed to repro the issue, and found that the result field is also missing when the status is InProgress, so have also made that optional.

from azure-devops-rust-api.

johnbatty avatar johnbatty commented on June 24, 2024 1

I've just published a new release 0.7.5 that I think should fix both of your issues (assuming that my speculative fix works).
Please try it out and let me know.

from azure-devops-rust-api.

SoftwareApe avatar SoftwareApe commented on June 24, 2024 1

@johnbatty Hi, I checked the response and the speculative fix on the pipelines indeed worked, the repository field is repository: Repository { id: None, type_: Some("gitHubEnterprise") }, I'm guessing this only happens with non-azure repos or something other that's unusual.

Getting an inProgress run (as well as a finished run) works, too.

Thank you!

from azure-devops-rust-api.

johnbatty avatar johnbatty commented on June 24, 2024 1

Great news. I suspected that the Repository might look like that, and would explain why I hadn't seen it (I've only tested with pipelines that refer to ADO repos).

Please continue to raise any other issues you find.

from azure-devops-rust-api.

SoftwareApe avatar SoftwareApe commented on June 24, 2024

I think Case #2 could be solved by replacing this diff in src/pipelines/models.rs:436

-    #[serde(rename = "finishedDate", with = "crate::date_time::rfc3339")]
-    pub finished_date: time::OffsetDateTime,
+    #[serde(rename = "finishedDate", with = "crate::date_time::rfc3339", skip_serializing_if = "Option::is_none")]
+    pub finished_date: Option<time::OffsetDateTime>,

However since this crate is auto-generated I won't add a PR.

from azure-devops-rust-api.

SoftwareApe avatar SoftwareApe commented on June 24, 2024

I checked and the optionality of finishedDate is indeed not documented. Could this somehow be patched?

https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/get?view=azure-devops-rest-7.1

from azure-devops-rust-api.

SoftwareApe avatar SoftwareApe commented on June 24, 2024

Looking at the API for the pipelines GET:
https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/pipelines/get?view=azure-devops-rest-7.1

It seems to be all there however I noticed the fields in the API definition are:

  • _links
  • configuration
  • folder
  • id
  • name
  • revision
  • url

However the response I get is:

  • _links
  • configuration
  • url
  • id
  • revision
  • name
  • folder

So I'm guessing we're looking for folder, find folder at the end. But then skip everything in between, and the next field id can't be found.

I guess the fix would be not to care for the order here. Is that possible?

from azure-devops-rust-api.

johnbatty avatar johnbatty commented on June 24, 2024

For Case 1, the issue is not field ordering - the code is fine with the fields in any order.

Given the information that you have provided, I think the issue is with an id field elsewhere in the nested structs. Looking at the definitions, I see that the configuration field is of type PipelineConfiguration, and that has a repository field of type Repository that has id and type fields which are currently required. I am guessing that in your scenario the id must be missing from this value (possibly the type too?). It would be good if you could confirm, if you can still repro and look at the data.

I'll make a speculative fix here to make both of these fields optional, which should hopefully fix your scenario.

from azure-devops-rust-api.

SoftwareApe avatar SoftwareApe commented on June 24, 2024

For case 1 I can check on Monday, I'm not sure what the output was, I just didn't want to post the full response here, but I could add a redacted response maybe.

from azure-devops-rust-api.

johnbatty avatar johnbatty commented on June 24, 2024

Yes - don't post any of your data here.
When you get the error, you should get the response data on the console. It will be a long single line. The error message gives you a location where the issue is, e.g. Error("missing field id", line: 1, column: 455). You should be able to copy/paste the data into an editor and look at that column position. It should be at the end of the object that is missing the id field. You might be able to figure out which structure field it is (in particular, whether it is the repository field).

from azure-devops-rust-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.