Comments (6)
Swift (iOS) and Kotlin (Android) can easily handle optional properties, but I am not sure about any other programming languages that people are using in combination with this API and how those languages handle optionals. It wouldn't be good if other peoples 'existing apps/websites break because of using a null-value, but personally I would prefer using null so you can keep yearOfBirth as an Int and wand length as a Double instead of using a String.
But really it is up to you, I can make it work with a String also :)
from hp-api.
@KostaSav
Works perfectly fine! Somehow Swift takes an Int value and automatically converts it to a Double, so that change is not needed.
Thanks for your help!
from hp-api.
Hi @devesmee ,
No, there is not a specific reasoning. These are probably bugs that need to be resolved and agree on a specific datatype for each field.
You can open a pull request for any inconsistencies you find and fix. Otherwise, I will have a look as well when I have the chance.
from hp-api.
Hi @KostaSav,
Would you like both of them to be a String and then an empty String when there is no value?
Or the yearOfBirth as an Int, the wand length as a Double and then a null value when no value is known?
from hp-api.
I am not sure, thinking about it.
What do you thing would be the best approach @devesmee? What would be easier/most effective for your iOS app and perhaps for other apps using this API?
from hp-api.
@devesmee
I have changed to null values for missing yearOfBirth and wand length. Please check if it's OK now.
About the integer/double values for wand length, I am not sure if that also causes issues. If it does, a JSON schema needs to be created with the datatypes of each field.
from hp-api.
Related Issues (14)
- Missing brackets on name HOT 3
- Billy Stubbs flagged as Hogwarts Student HOT 1
- API not working HOT 3
- API DOWN HOT 1
- some characters have no image HOT 1
- Data without ID's HOT 2
- How can i contribute? HOT 1
- add images for other characters
- Query for character details HOT 2
- Characters with Empty Images HOT 5
- Added styles to the website HOT 1
- No 404 handling route HOT 1
- Configure URLs under index.html to point to the corresponding host (Render, Heroku)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hp-api.