Problem/Motivation

With JSON Schema:

  • Describes various drupal yaml file formats.
  • Provides clear human- and machine- readable documentation.
  • Validates data which is useful for:
    • Automated testing.
    • Ensuring quality of client submitted data.

This is really useful for developer, and along Schema store can ease developer when developing drupal.

Proposed resolution

Provide schema for drupal specific yaml files.

Remaining tasks

  • .info.yml
  • .libraries.yml
  • .links.action.yml
  • .links.menu.yml
  • .links.task.yml
  • .permissions.yml

API changes

Probably JSON Schema can be used to validate above files in drupal system.

CommentFileSizeAuthor
#16 services-yml.png260.34 KBchi
#2 drupal.info.json_.txt4.88 KBel7cosmos

Comments

el7cosmos created an issue. See original summary.

el7cosmos’s picture

StatusFileSize
new4.88 KB

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dave reid’s picture

How can other contributed modules add to this schema?

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

chi’s picture

I think most of Drupal core yaml files have appropriate schemas. See #3061454: Add JSON schema for Drupal core yaml files for details.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

chi’s picture

I think it was a mistake to add JSON schemas to schemastore this way. It's hard to maintain the schemas if you don't have access to them. We should have added just references to the repository with the schemas. Preferably, it should be Drupal core repository.

I propose the following changes.

1. Copy JSON schemas from https://github.com/5n00p4eg/Drupal-json-schemas to Drupal core.
2. Create a pull request for schemastore to replace the schemas.

chi’s picture

Since next PhpStorm release it should be possible to reference schemas in the Yaml files.
https://youtrack.jetbrains.com/issue/IDEA-271611

chi’s picture

StatusFileSize
new260.34 KB

Re #14
Since Drupal added support for service aliases the current JSON schema is no longer valid. Someone has to fix it and make a PR to schema store.

Services yaml

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

lostcarpark’s picture

I have created a PR in SchemaStore to add shorthand aliases.

https://github.com/SchemaStore/schemastore/pull/6229

lostcarpark’s picture

Moving the schemas back into a Drupal repo would seem to make sense, but for the short term I just thought we should get a small change in to stop IDEs getting upset about service.yml files.

nicxvan’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update

The link in the issue summary is 404, can someone find the right link?

lostcarpark’s picture

SchemaStore PR has been merged, and I can see it on the schemastore.org site. I'm not sure how long it takes to propagate through to my IDE, but hopefully service aliases will stop being flagged as errors soon.

@nicxvan I think the link should be https://www.schemastore.org/ - I'll update now.

lostcarpark’s picture

Issue summary: View changes
lostcarpark’s picture

Well the aliases are fixed, but because of all the red underlines, I hadn't noticed autowire and autoconfigure were also missing from the schema.

I've now opened another SchemaStore PR to fix it.

longwave’s picture

Maybe we should maintain a copy of the schemas in core, where we can use a test to ensure they are valid; we would still need a manual process to push them upstream after that unless SchemaStore can sync from us somehow.

nicxvan’s picture

I checked the issue queue and didn't see a way to manage the schema externally.

We could create an issue to discuss there.