Skip to content

[Epic] Validation rules for Plugin Generation in Kiota #5162

Closed
@maisarissi

Description

@maisarissi

We need to enhance the plugin generation process in Kiota by implementing validation rules. These validations will ensure that the generated plugins function correctly.
Some of these validations address current limitations that may be resolved in the future. However, it is crucial to ensure that the generated plugins work with the current constraints.

### Tasks
- [ ] https://github.com/microsoft/Microsoft.Plugins.Manifest/issues/255
- [ ] https://github.com/microsoft/kiota/issues/5164
- [ ] https://github.com/microsoft/kiota/issues/5381
- [ ] https://github.com/microsoft/Microsoft.Plugins.Manifest/issues/259
- [ ] https://github.com/microsoft/Microsoft.Plugins.Manifest/issues/256
- [ ] https://github.com/microsoft/Microsoft.Plugins.Manifest/issues/257
- [ ] https://github.com/microsoft/kiota/issues/5380
- [ ] https://github.com/microsoft/Microsoft.Plugins.Manifest/issues/258

Requirements

  • Requirement 1: Validate all the above rules before generating a plugin and only generate the plugin if there are no issues.
  • Requirement 2: Warn the user if their OpenAPI is not valid for plugin creation and don't generate the plugin
  • Requirement 3: Inform the user which selected endpoints are failing validation and the specific reason. For example, one has 10 endpoints selected to create a plugin and just 1 fails due to nested objects in the PUT method; notify of the specific endpoints and the reason for the failure.

Activity

moved this to Needs Triage 🔍 in Kiotaon Aug 14, 2024
maisarissi

maisarissi commented on Aug 14, 2024

@maisarissi
ContributorAuthor

Tasks:

  • 4 Only authorization code are supported as OAuth grant flows
  • 5 API Key in custom headers, query params or cookies are not supported
  • 6 Dual authentication flows (API Key AND OAuth token) for single API endpoint are not supported

Can be resolved with #5071

baywet

baywet commented on Aug 14, 2024

@baywet
Member

I do have a bunch of questions about those rules...

Nested objects in response or parameters in API methods are not supported

What qualifies as nested object? an inline object type definition? or are you referring to properties that are of object types in general? (e.g. assigned licenses for user in Graph)

Polymorphic references in open API spec (oneOf, allOf, anyOf) are not supported

This is how we define inheritance (entity<-directory object<- user), which would in effect rule out most API definitions out there. We need to be much more specific here.

Circular references in open API spec are not supported

Likewise we have plenty of those in Microsoft Graph. E.g. a User has a manager property which is a user... Also should we consider multiple degrees of separation? (e.g. user.memberof ->group, group.members -> user)

Only authorization code and PKCE are supported as OAuth grant flows

Providing examples would help here.

API Key in custom headers, query params or cookies are not supported

Examples please.

Dual authentication flows (OAuth/Entra SSO + http Bearer token) for single API endpoint

Examples please.

OpenAPI descriptions needs to be 3.1.0 or previous versions

Considering 3.1.0 is not supported yet by OAI.net we should revisit this one for our current timelines.

Server url should be an absolute url with https protocol

Or in simple terms "should start with https://, case insensitive"

moved this from Needs Triage 🔍 to In Review 💭 in Kiotaon Aug 15, 2024
moved this from In Review 💭 to Proposed 💡 in Kiotaon Aug 15, 2024
petrhollayms

petrhollayms commented on Aug 16, 2024

@petrhollayms
Contributor

@maisarissi Shall we move it from Proposed to Todo? (meaning, is it a must-have for GA?)

maisarissi

maisarissi commented on Aug 23, 2024

@maisarissi
ContributorAuthor

@baywet I've added the examples and details around the validations in each of the new issues created.

After talking to @darrelmiller, I've created validation issues in the validation library. On top of the validations in the validation lib, linked to this epic, In Kiota we should still validate:

  • The OpenAPI description version needs to be < 3.1.0
  • There can't be circular reference in the selected paths by the user

If any above validation fails, we need throw an error.

For inheritance (allOf, oneOf, anyOf) in request bodies, I've created a new issue for Kiota to handle the scenario: #5164

For the circular reference we should list all selected paths that are causing the error.
I'm good with moving to Todo @petrhollayms

moved this from Proposed 💡 to Todo 📃 in Kiotaon Sep 2, 2024

29 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done ✔️

    Relationships

    None yet

      Development

      Participants

      @darrelmiller@calebkiage@andrueastman@sebastienlevert@baywet

      Issue actions

        [Epic] Validation rules for Plugin Generation in Kiota · Issue #5162 · microsoft/kiota