microsoft / microsoft/kiota

Allow relaxing of OAS validation failures via `--exclude-path`

Open
#7,343 0 comments 0 reactions 0 assignees View on GitHub
status:waiting-for-triage type:feature
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### Is your feature request related to a problem? Please describe the problem.

In events where the OAS doesn't fully conform, we should be able to relax validation so generation can proceed. Considering many cases where you are not in a position to fix the underlying OAS, this would provide an escape hatch. In the following example, a `path` parameter is defined but isn't used, which throws an error:

`OpenAPI error #/paths/~1/get/parameters/0/in - Declared path parameter "path" needs to be defined as a path parameter at either the path or operation level`

Excluding this path doesn't seem to work, and subsequent command don't run because kiota returns a non-zero exit code after the above error. So the only option left is to just swallow the exit-code so we can continue on

```json
"/": {
"get": {
"tags": [
"StaticResource"
],
"parameters": [
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
```

### Client library/SDK language

C#

### Describe the solution you'd like

I'd like the `--exclude-path` flag to skip validation on OAS endpoints I don't care to generate anyway, or some kind of CLI flag that ignores OAS validation issues.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the CLI handling for `--exclude-path` and trace how OpenAPI validation errors produce the non-zero exit code. Reproduce the supplied malformed `/` path, then verify that excluding it or using the proposed validation option allows generation and subsequent commands to continue without masking unrelated failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.