microsoft / kiota

OpenAPI based HTTP Client code generator
https://aka.ms/kiota/docs
MIT License
2.86k stars 195 forks source link

Azure Devops Support for search/download/generate #3338

Open marleypowell opened 1 year ago

marleypowell commented 1 year ago

It looks like there's no support for using the Kiota CLI for private Azure Devops repositories where API schemas are stored.

baywet commented 1 year ago

Hi @marleypowell, You are correct, the only search providers that are implemented today are:

We don't currently have plans to support descriptions stored in ADO or in ADO server. But we'll use this issue to track interest. We do have plans to support additional registries, but nothing to publicly share yet.

sebastienlevert commented 1 year ago

@marleypowell can you expand on how you are storing your API descriptions in ADO? As OpenAPI files in different repos, in a single repo, etc.? This will help with identifying the needs and prioritization! Thanks!

marleypowell commented 1 year ago

@marleypowell can you expand on how you are storing your API descriptions in ADO? As OpenAPI files in different repos, in a single repo, etc.? This will help with identifying the needs and prioritization! Thanks!

OpenAPI files in different repos in the same project currently.

We're using an adaptation of what backstage does for parsing repo file urls into API urls - https://github.com/backstage/backstage/blob/master/packages/integration/src/azure/AzureUrl.ts#L25

Part of a bash script used in an Azure Pipeline:

downloadUrl="$(System.CollectionUri)$project/_apis/git/repositories/$repo/items?path=$path&download=true&api-version=7.0"
openAPISpec="$(curl --silent -u azdo:$(System.AccessToken) $downloadUrl"

At a minimum it would be nice if kiota could accept either an access token or custom http request headers.

sebastienlevert commented 1 year ago

Thanks for the details! This is very useful for us! In your case, am I right to assume that you are using a on-premises version of Azure DevOps?

How would you order the following statements in terms of prioritization for your scenarios?

  1. CLI: Support for passing an OpenAPI description string to Kiota (instead of a path)
  2. CLI: Support for retrieving a description from a specific secured URL with custom HTTP Headers
  3. CLI: Support for retrieving a description from a specific secured URL while being logged in
  4. CLI: Searching for available secured OpenAPI descriptions
  5. VS Code: Support on our VS Code extension for secured OpenAPIs descriptions
marleypowell commented 1 year ago

Thanks for the details! This is very useful for us! In your case, am I right to assume that you are using a on-premises version of Azure DevOps?

How would you order the following statements in terms of prioritization for your scenarios?

  1. CLI: Support for passing an OpenAPI description string to Kiota (instead of a path)
  2. CLI: Support for retrieving a description from a specific secured URL with custom HTTP Headers
  3. CLI: Support for retrieving a description from a specific secured URL while being logged in
  4. CLI: Searching for available secured OpenAPI descriptions
  5. VS Code: Support on our VS Code extension for secured OpenAPIs descriptions

We actually use Cloud based Azure Devops.

The ordering would probably be something like this:

2.CLI: Support for retrieving a description from a specific secured URL with custom HTTP Headers This is the main thing we're working around at the moment (CI use case)

3.CLI: Support for retrieving a description from a specific secured URL while being logged in If understood correctly this would be useful for local use when already logged in to a Microsoft account

5.VS Code: Support on our VS Code extension for secured OpenAPIs descriptions Not everyone uses VSCode (mostly VS2022). Also didn't realise that there was an extension. It could potentially be useful although we mostly want to generate API clients automatically in CI

4.CLI: Searching for available secured OpenAPI descriptions. Searching OpenAPI specs isn't too much of a problem for us as we're using backstage.io as our Developer Portal which supports this.

1.CLI: Support for passing an OpenAPI description string to Kiota (instead of a path) I don't think there's many scenarios that we won't just want to point to either a remote or local file

pschaeflein commented 1 year ago

Since you are using this issue for interest tracking, I'll add my use case:

@baywet @sebastienlevert

baywet commented 1 year ago

Thanks for sharing insights about your correct @pschaeflein In that scenario, how do developers on your team get the descriptions so they can perform the initial generation? Do they clone both repositories?

pschaeflein commented 1 year ago

The dev who updates our API runs the generation from localhost and commits the updated api client. (Refer to the localhost cache issue.)