google-wallet / passes-rest-samples

Server-side samples for the Google Pay API for Passes
Apache License 2.0
95 stars 48 forks source link

Nodejs is bitterly missed #17

Closed s-a closed 4 years ago

s-a commented 4 years ago

:(

mladenilic commented 4 years ago

Hi @s-a, I'm not a member of this organization, but I had my fair share of frustration with the walletobjects api.

You can generate it yourself using discovery service. People having the same problem with ruby client as well - https://github.com/googleapis/google-api-ruby-client/issues/747.

Based on a quick test, nodejs seems even worse, as it will require you to fork the client itself, but npm run generate ./wobs-discovery.json should do the trick.

Hope it helps!

s-a commented 4 years ago

@mladenilic well at the end it was not so hard to implement with Node. Currently iam looking for a solution to validate data against JSON schema, I found https://walletobjects.googleapis.com/$discovery/rest?version=v1 and tried against Ajv, but without success so far. @angelbarranco is there a valid JSON schema regarding https://json-schema.org/ for passes json data available?

angelbarranco commented 4 years ago

Hey @s-a ,

Please try with Schema Draft 6, Ajv instructions.

s-a commented 4 years ago

@angelbarranco well i think it should be 7. Tried your suggestion but then it fails to compile with unknown datatype double and int64. Are you familiar with ajv ? The prolem is that all validations always return a valid result even if I pass badly wrong data in validation.

s-a commented 4 years ago

Well this is not a valid json schema. I came to the solution to generate one based on the discovery document. But is a poor solution. For example the required information for properties is only available in comments as text form. Does there exist a valid JSON schema some where?

angelbarranco commented 4 years ago

Hey @s-a,

I have not used it before. I do see that now. Wallet objects API does not have official libraries for node nor strict adherence to JSON schema validator for the discovery document. It is used by our tools to explore the API. So I do not know of any valid JSON schema.

The library for node.js is something we are looking at for the future though.

s-a commented 4 years ago

@angelbarranco thank you. Can you point me to a place where I can submit a request for a JSON schema? I think this kind of document will bring good benefits for this API

angelbarranco commented 4 years ago

Sure. You can submit it here.