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

Support $ref in DefinitionProperty #23

Closed
saosebastiao opened this issue Apr 7, 2016 · 6 comments
Closed

Support $ref in DefinitionProperty #23

saosebastiao opened this issue Apr 7, 2016 · 6 comments

Comments

@saosebastiao
Copy link

Description

The Swagger Provider doesn't support the $ref aspect of the spec

Repro steps

let path = "swagger.json" (* uses $ref , example: instagram swagger api example *)
type PetStore = SwaggerProvider<path, "Content-Type=application/json">

Related information

May be related to the refs being part of the 2.0 spec, but I'm not sure.

@sergey-tihon
Copy link
Member

@saosebastiao Could you please specify what do you expect mean by $ref aspect of the spec? Or what do you expect to see?

SwaggerProvider support $ref.

All schemes that has custom type definition uses $ref to reference to them.
Like here https://github.com/fsprojects/SwaggerProvider/blob/master/tests/SwaggerProvider.Tests/Schemas/PetStore.Swagger.json#L54 you see reference to https://github.com/fsprojects/SwaggerProvider/blob/master/tests/SwaggerProvider.Tests/Schemas/PetStore.Swagger.json#L675

SwaggerProvider generates .NET types for all definitions and resolve reference them.

@saosebastiao
Copy link
Author

I'm getting the following error when trying to use the type provider for the Instagram API spec:

Error FS3033: The type provider 'SwaggerProvider.SwaggerTypeProvider' reported an error: Reference to unknown type #/definitions/Media (FS3033) (FSharpTest)

The swagger file provided does indeed define a Media data type.

Here is a repo that attempts to reproduce the error:
https://github.com/saosebastiao/FSharpTest

@sergey-tihon
Copy link
Member

Thanks, nice sample.
Where did you get this schema?

I just wonder why your Instagram API swagger.json differ from one listed in API.guru // cc: @IvanGoncharov

@saosebastiao
Copy link
Author

I got it from the sample sets available for the demo editor at
http://editor.swagger.io/#/

On Fri, Apr 8, 2016 at 3:01 PM, Sergey Tihon [email protected]
wrote:

Thanks, nice sample.
Where did you get this schema?

I just wonder why your Instagram API swagger.json
https://github.com/saosebastiao/FSharpTest/blob/master/FSharpTest/swagger.json
differ from one listed in API.guru
https://apis-guru.github.io/api-models/instagram.com/1.0.0/swagger.json
// cc: @IvanGoncharov https://github.com/IvanGoncharov


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#23 (comment)

@IvanGoncharov
Copy link
Contributor

@sergey-tihon Instagram doesn't provide official Swagger files.
Both files are manually written, swagger-editor version is intended as a sample.
So it's incomplete and out of sync.
For APIs.guru I use this version:
https://github.com/darklynx/swagger-api-collection/blob/master/api/yaml/instagram.yaml

@sergey-tihon sergey-tihon changed the title Support $ref Support $ref in DefinitionProperty Apr 8, 2016
@sergey-tihon sergey-tihon mentioned this issue Apr 8, 2016
4 tasks
@sergey-tihon
Copy link
Member

Fix released in v0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants