Comments (3)
There were couple approaches considered as a fix:
- Having separate admin-api-validator instance per API - this would ensure schemas are never mixed in the cache.
- Use additional prefix/postfix when identifying $id in schema
1st approach pros/cons
pros:
- no need to modify schemas
- no maintenance for prefix/postfix when new version is released
cons:
- package API needs to change to create a separate instance of ajv validator
- need to change Ghost core to use new API
- adds burden on the client user to "remember" to have a separate instance per API, and not being able to retreive/validate schemas on the same validator instance (unfriendly dev-experience imo)
2nd approach pros/cons
pros:
- no changes to API or clients
- keeps full functionality and single interface to access schemas/validations form any API version
cons:
- need to maintain API prefix/postfix in the schema when creating new schema version folder
Given that the con from 2nd approach only happens 1 time a year (during new version release) and is pretty straight forward search/replace will go down this path. Also, there's possibility to automate this with a script if it's ever painful! IMO, keeping friendly, no "hidden tricks" package api and less changes in Ghost core far outweighs small maintenance burden.
from sdk.
Considerations around prefix or postfix naming change
There's not much difference in either approach. The only reason going with postfix notation $id: "{resource}.{version}"
e.g.: "$id": "labels.canary"
is to avoid regressions in existing use-case where error message is formed here.
from sdk.
For reference "$id" property naming conventions for JSON Schema - https://json-schema.org/understanding-json-schema/structuring.html#the-id-property. There is no specific convention enforced except:
The $id property should never be the empty string or an empty fragment (#), since that doesn’t really make sense.
And it's primary goal is:
The $id property is a URI-reference that serves two purposes:
- It declares a unique identifier for the schema.
- It declares a base URI against which $ref URI-references are resolved.
from sdk.
Related Issues (20)
- Add v4 to typings? HOT 2
- Update @tryghost/content-api to support Ghost v4
- Reading time only count latin words
- Admin API uses {} for the body of GET requests causing problems with Google Cloud services HOT 1
- Dependency Dashboard
- Refuse to set unsafe header User-Agent HOT 3
- Can't use v5 with typescript HOT 5
- [ghost admin] Build failure when using @tryghost/admin-api HOT 4
- Cannot convert undefined or null to object HOT 1
- Unable to request multiple pages HOT 2
- [image-transform] Unable to define better image quality than default
- Documentation typos HOT 2
- TypeScript support for the admin api client HOT 6
- Got “Invalid token” in Admin API Token authentication even with the token generated by the Bash (cURL) sample code in Doc. HOT 1
- Consider Migrating Dependency `jsonwebtoken` to `jose` HOT 1
- Unable to uninstall @tryghost/content-api
- Image upload via admin api HOT 1
- Brows Ghost api
- Creating a new member HOT 2
- 'reading_time' parameter not returned when used in 'fields' query of Ghost Content API HOT 1
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 sdk.