Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"no compatible schema found" error. Can the tool evaluate schema $refs under the top of the path? #157

Open
1 task done
99-lives opened this issue Apr 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@99-lives
Copy link

tfplugingen-openapi CLI version

v0.3.0

OpenAPI Spec File

'/users/{user-id}':
  get:
    responses:
      2XX:
        description: Retrieved entity
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/(reference path)'

Generator Config

provider:
  name: (name)
data_sources:
  users:
    read:
      path: /users/{user-id}
      method: GET

Expected Behavior

Evaluate the reference schema and generate the provider code spec.

Actual Behavior

Failed with error:

time=(redacted) level=WARN msg="skipping data source schema mapping" data_source=users err="no compatible schema found"

Additional Information

Hi team,

The OpenAPI spec for the system I am trying to create a provider for has a reference to the response object schema at the top of the schema block. Does the tool support this?
I saw on the DESIGN.md that it does support expanding a $ref tag, but it was inside of a nested schema.

Or perhaps I'm doing something wrong here?

Cheers,
Harry

Code of Conduct

  • I agree to follow this project's Code of Conduct
@99-lives 99-lives added the bug Something isn't working label Apr 19, 2024
@99-lives 99-lives changed the title ""no compatible schema found"" error. Can the tool evaluate schema $refs under the top of the path? "no compatible schema found" error. Can the tool evaluate schema $refs under the top of the path? Apr 19, 2024
@bflad
Copy link
Contributor

bflad commented Apr 25, 2024

Hi @99-lives 👋 Thank you for raising this and sorry you ran into trouble here. This tool's design should be expanding/following references such as those automatically. Is the OpenAPI specification publicly available or can you share it? Otherwise could you provide the actual parts of the specification (changing names, etc. if necessary) so we can reproduce the issue you are seeing with a fully valid specification? Thanks so much.

@bflad bflad added the waiting-response Issues or pull requests waiting for an external response label Apr 25, 2024
@99-lives
Copy link
Author

Sure @bflad, I'm working on a provider for the Microsoft Graph API, as a side project to help me with my job in IT. The OpenAPI spec for it is available here:
https://github.com/microsoftgraph/msgraph-metadata/blob/master/openapi/v1.0/openapi.yaml

Beware, it's a 27mb text file!

@tuananh
Copy link

tuananh commented Jul 18, 2024

I face this issue as well , in my case it's IBM API connect openapi specs.

The data_sources work fine while resources doesn't.

@github-actions github-actions bot removed the waiting-response Issues or pull requests waiting for an external response label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants