Visitar URL original
WIP - Handle only postable resource by jfthuillier · Pull Request #54 · api-platform/api-doc-parser · GitHub
The Wayback Machine - https://web.archive.org/web/20201018134744/https://github.com/api-platform/api-doc-parser/pull/54
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Handle only postable resource #54

Open
wants to merge 1 commit into
base: master
from

Conversation

@jfthuillier
Copy link
Contributor

@jfthuillier jfthuillier commented May 6, 2019

Fix issue #53

JF
* @return {string}
*/
function guessUrlFromPropertyId(propertyId) {
return `${propertyId.replace("docs.jsonld#Entrypoint/", "")}s`;

This comment has been minimized.

@dunglas

dunglas May 6, 2019
Member

This hardcoded replacement creates a hard coupling with API Platform Core while we want this lib to work with any Hydra implementation.

The base URL can be extracted from hydra:entrypoint (and is probably available somewhere as a var).

The resource name could be extracted using the URL API (hash part) and a regex, even.

Some plural don't end by a s, this shouldn't be hardcoded as well.

@@ -19,6 +19,10 @@ const entrypoint = `{
"deprecatedResource": {
"@id": "Entrypoint/deprecatedResource",
"@type": "@id"
},
"onlyPostResource": {
"@id": "Entrypoint/onlyPostResource",

This comment has been minimized.

@dunglas

dunglas May 6, 2019
Member

post only would sounds more English

@dunglas
Copy link
Member

@dunglas dunglas commented May 6, 2019

I think that it should be fixed in API Platform Core first.

  1. In the API entrypoint, (/index.jsonld), every properties should be listed, even if now GET operations are associated with them (AFAIU, it's currently not the case, and it's wrong).
  2. In the API documentation (/docs.jsonld), this new property of the entrypoint must be marked with readable: false and writeable: true, as it's indeed a write-only property of the API entrypoint.
  3. We have to check that this is supported in this lib

Doing this would allow to remove most hardcoded code, and will be cleaner. WDTY?

@jfthuillier
Copy link
Contributor Author

@jfthuillier jfthuillier commented May 7, 2019

I agree, i had the same feeling that this solution was "hacky". I'll consider your comment and investigate into the core.

@jfthuillier jfthuillier changed the title Handle only postable resource WIP - Handle only postable resource May 7, 2019
@StanislavUngr
Copy link

@StanislavUngr StanislavUngr commented Sep 25, 2019

Hello guys. Is there any progress to this PR?
We are currently using ApiPlatform and the fetch always fails on the mentioned line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.