fsprojects-archive / zzarchive-ApiaryProvider

[ARCHIVED] Type provider for Apiary.io
Other
10 stars 10 forks source link

not working with Volusion Storefront API #15

Open ctaggart opened 10 years ago

ctaggart commented 10 years ago

I'm trying this out with our Volusion Storefront API, but I wasn't able to get this working.

let store = new ApiaryProvider<"volusion">("http://www.samplestore.io")

After debugged this for a while this evening, I found that in ApiaryGenerator.fs the body.InnerText was returning "", so I changed the code to be:

  let generateMembersForJsonResult (ctx:ApiaryGenerationContext) name spec =

    let samples = 
      [ for example in spec?responses do
          if example?status.AsInteger() = 200 then 
            match example.TryGetProperty "body" with
            | Some body ->
                let source = body.InnerText()
                if String.IsNullOrEmpty source then ()
                else yield JsonValue.ParseSample source
            | None -> () ]

This got me past that error, but nothing was quite right. Just looking to be pointed in the right direction.

ctaggart commented 10 years ago

The next issue is that when I try to get the categories, it has created a function called CategoriesSlugSlug() that when run leaves slug={slug} url encoded in the query string.

GET http://www.samplestore.io/api/v1/categories?slug=%7Bslug%7D

image

image

I was expecting a store.Categories.List() or something similar. This is based on these resources defined at http://api.apiary.io/blueprint/resources/volusion

image

ovatsus commented 10 years ago

I don't have time to debug this, but if you send pull requests I can have a quick look and merge them. One of the reasons I moved ApiaryProvider out of F# Data was because it's not very stable, most of the APIs I tried required special handling to handle new cases