microsoft / microsoft/kiota

The schema reference is not resolved

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

Description

### What are you generating using Kiota, clients or plugins?

API Client/SDK

### In what context or format are you using Kiota?

Nuget tool

### Client library/SDK language

Csharp

### Describe the bug

When trying to generate a client from the [ideal-postcodes.co.uk](https://ideal-postcodes.co.uk) OpenAPI [json](https://openapi.ideal-postcodes.co.uk/openapi.json)/[yaml](https://openapi.ideal-postcodes.co.uk/openapi.yaml), an error is generated

```
warn: Kiota.Builder.KiotaBuilder[0]
Discriminator Context is not inherited from Context.
warn: Kiota.Builder.KiotaBuilder[0]
Discriminator NoContext is not inherited from NoContext.
warn: Kiota.Builder.KiotaBuilder[0]
Discriminator HereAddress is not inherited from HereAddress.
crit: Kiota.Builder.KiotaBuilder[0]
error generating the client: One or more errors occurred. (One or more errors occurred. (The schema reference is not resolved))
```

Seems to occur on all languages. Assume this is either an issue with the ideal-postcodes.co.uk OpenAPI.json, or how Kiota is processing it before getting to the language generation.

Have tried on both 1.29.0 and 1.30.0

If this is a problem with the ideal-postcode.co.uk OpenAPI.json, then happy to feedback any information that will help identify the problem and what they need to fix.

Or if there's a quick fix for generating a client, by manually fixing the .json that would be appreciated

### Expected behavior

The client to generate successfully. Or a clearer message as to exactly where the error is. If the error is in the OpenAPI.json it would be handy to know what's causing it to feedback to ideal-postcodes.co.uk

### How to reproduce

`kiota generate --openapi https://openapi.ideal-postcodes.co.uk/openapi.json --language csharp`

### Open API description file

https://openapi.ideal-postcodes.co.uk/openapi.json

### Kiota Version

1.30.0 / 1.29.0

### Latest Kiota version known to work for scenario above?(Not required)

Unknown

### Known Workarounds

None

### Configuration

- OS: Windows 11 25h2
- Architecture: x64
- Likely not configuration specific

### Debug output

Click to expand log
```

kiota generate --openapi https://openapi.ideal-postcodes.co.uk/openapi.json --language csharp --ll debug
dbug: Kiota.Builder.KiotaBuilder[0]
kiota version 1.29.0
dbug: Kiota.Builder.KiotaBuilder[0]
cache file C:\Users\user\AppData\Local\Temp\kiota\cache\generation\9128E115974229C79C75297D8FB952F09D3B80233108EDE68D239C25E7DA589D\openapi.json not found, downloading from https://openapi.ideal-postcodes.co.uk/openapi.json
info: Kiota.Builder.KiotaBuilder[0]
loaded description from remote source
dbug: Kiota.Builder.KiotaBuilder[0]
step 1 - reading the stream - took 00:00:00.7197447
dbug: Kiota.Builder.KiotaBuilder[0]
step 2 - parsing the document - took 00:00:00.1237987
dbug: Kiota.Builder.KiotaBuilder[0]
step 3 - updating generation configuration from kiota extension - took 00:00:00.0000628
dbug: Kiota.Builder.KiotaBuilder[0]
step 4 - filtering API paths with patterns - took 00:00:00.0024463
info: Kiota.Builder.KiotaBuilder[0]
Client root URL set to https://api.ideal-postcodes.co.uk/v1
dbug: Kiota.Builder.KiotaBuilder[0]
step 5 - checking whether the output should be updated - took 00:00:00.0180995
dbug: Kiota.Builder.KiotaBuilder[0]
step 6 - create uri space - took 00:00:00.0020218
dbug: Kiota.Builder.KiotaBuilder[0]
InitializeInheritanceIndex 00:00:00.0019734
warn: Kiota.Builder.KiotaBuilder[0]
Discriminator Context is not inherited from Context.
warn: Kiota.Builder.KiotaBuilder[0]
Discriminator NoContext is not inherited from NoContext.
warn: Kiota.Builder.KiotaBuilder[0]
Discriminator HereAddress is not inherited from HereAddress.
crit: Kiota.Builder.KiotaBuilder[0]
error generating the client: One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (One or more errors occurred. (The schema reference is not resolved))))

```

Contributor guide

Open the contributing guide

Research direction

Start by running the reported `kiota generate` command against the linked OpenAPI JSON and review the schema references around the reported discriminator warnings. Trace where the unresolved reference is handled in Kiota's generation flow; done means identifying the offending reference and either allowing generation to complete or producing a precise diagnostic for the invalid schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api, tooling
Issue type
Bug
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.