Thanks so much for this module.
I am working on the OpenAPI module. Currently it has some code I copied over from the previous version of this module but I would like to remove it and rely on this module.
#2870393: Remove openapi_json_schema submodule and add dependency on Schemata module
I can almost use this module expect that you can longer produce schema for just and entity type if the entity also supports bundles.
This is needed when creating the OpenAPI spec because the REST resources don't really point to specific bundle(unlike JSON API).
This patch will add a route for all entity types regardless of whether they also supports bundles.
I am attaching Open API JSON file produced with patch to this module.
If look at the definitions section of this json you will see a definition for node, node:article and node:page. This is possible with changes to this module.
Comment | File | Size | Author |
---|---|---|---|
#22 | 2870904-22.patch | 54.94 KB | tedbow |
| |||
#21 | 2870904-21-including-2871167-28.patch | 115.87 KB | tedbow |
| |||
#21 | 2870904-21-do-not-test.patch | 55.15 KB | tedbow |
#19 | 2870904-19-including-2871167-25.patch | 88.52 KB | tedbow |
| |||
#19 | 2870904-19-do-not-test.patch | 42.55 KB | tedbow |
Comments
Comment #2
tedbowPull request: https://github.com/phase2/schemata/pull/15
Comment #3
Grayside CreditAttribution: Grayside at Phase2 for Norwegian Cruise Line commentedI have reviewed the PR, and there were a couple minor bits that need work.
Comment #4
tedbow@Grayside thanks for looking at the PR. I update the PR and pushed new commits that address your concerns I think.
Comment #5
jludwig CreditAttribution: jludwig at SciShield commentedThere is discussion in the PR about whether to add a new route for each bundle or to change it to one or two routes with paths like this:
/schemata/{entity_type}/{bundle}
What is in the current PR works fine, and whether to change that or not requires a discussion because it may affect things like local tasks. This is important issue so my suggestion would be to get this PR in first and open another issue to discuss whether to use a dynamic path and less routes.
Comment #6
Grayside CreditAttribution: Grayside at Phase2 for Norwegian Cruise Line commentedAgreed, handling the routes more dynamically is a separate issue.
Comment #7
Grayside CreditAttribution: Grayside at Phase2 for Norwegian Cruise Line commentedComment #8
Grayside CreditAttribution: Grayside at Phase2 commentedCopied the patch version of the Github PR to see if I can get the tests to run.
Comment #9
Grayside CreditAttribution: Grayside at Phase2 commentedComment #10
Grayside CreditAttribution: Grayside at Phase2 commentedComment #12
Grayside CreditAttribution: Grayside at Phase2 commentedComment #13
Grayside CreditAttribution: Grayside at Phase2 commentedComment #15
tedbowOk here is patch from that same PR.
Comment #16
tedbowNamespace was wrong in RequestTest so test was not found.
Comment #18
tedbowRetesting against core 8.3.x.
8.4.x will not work until #2871167: Replace rest.link_manager with hal.link_manager and add a dependency on hal is fixed.
UPDATE: actually that change was in 8.3.x too so testing against 8.2.x
Comment #19
tedbowOk not that #2871167: Replace rest.link_manager with hal.link_manager and add a dependency on hal is hopefully close to be done.
Here a patch that adds test changes from that issue and also adds the expectations for the new routes created by this issue.
Uploading 2 patches. 1 with both issues changes to get the tests to pass and 1 with just this issues changes.
Comment #20
dawehnerWell, technically every entity type supports bundles, just some of them don't have an entity type connected to it, see
\Drupal\Core\Entity\EntityTypeBundleInfo::getAllBundleInfo
. Is this restriction strictly needed?Comment #21
tedbow@dawehner thanks for the review
The previous code was still using $entity_type->getBundleEntityType() to determine which entity types should get a route for every bundle so the this functionality remains the same.
I will update that comment though to be more accurate.
Comment #22
tedbowrerolled after #2871167: Replace rest.link_manager with hal.link_manager and add a dependency on hal
Comment #23
tedbowCreated new pull request https://github.com/phase2/schemata/pull/22 , sorry for inconvience
Comment #24
e0ipsoI reviewed this in GitHub already, forgot to update here too.
Comment #25
Grayside CreditAttribution: Grayside at Phase2 commentedAwesome to see test coverage continue to expand on this.
Per the comment near the bottom of the Github PR, there are a couple issues in the backlog for automated schema validation:
Comment #26
Grayside CreditAttribution: Grayside at Phase2 commentedAnother potentially relevant follow-up is #2798019: Deduplicate property names and centralize entity properties, wherein we consider the value of modifying schema output for entities with bundles to leverage a separate schema for common elements.
Comment #27
Grayside CreditAttribution: Grayside at Phase2 commentedAnother closely related issue, custom fields attached to user entity (a no-bundle situation) do not show up in the schema.