nbnuk / nbn-project-hub

0 stars 3 forks source link

Question: NBN Atlas API response objects - ideas/advice wanted #18

Open h-m-jones opened 1 year ago

h-m-jones commented 1 year ago

The NBN Atlas API often returns a lot of JSON. For non-scientific applications, much of the JSON data is not needed. This is certainly case for our simple to use React components. Therefore simple DTO's could be defined for use in components.

Lets start with the JSON returned from "Occurrence search end point" Example:

https://records-ws.nbnatlas.org/occurrences/search?q=:&fq=data_provider_uid:dp7

The question is, how are these response objects defined.

  1. They should be in a separate package (common library) for use outside of the react components package, e.g for use also in an eExpo package, or perhaps a future "practice angular" package
  2. Can we use swagger
  3. What about Zod
  4. Should it be typescript or JSDoc?

Any thoughts?

h-m-jones commented 1 year ago

Decided upon Zod and TypeScript.

TemplateDataFetchingComponent is template component showing how everything works together to parse the API response.