-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add JSON schema for Development Container Template Metadata #350
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thankful, please advise
}, | ||
"required": [ | ||
"id", | ||
"name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is name required? It might be, but we don't have it written down it seems. It is optional for features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. It isn't marked as required in devContainerFeature.schema.json
now that I look at it, but it is on the implementors page. I'm not yet familiar enough with the spec to know which is accurate, but I suppose the other should be updated to match. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshspicer Should we make name
required in the features schema? Would a feature work if it had no name currently? If not, we would know that making it required in the schema won't break anyone. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the tooling name
is not required. For example when we build the READMEs in devcontainers/action
it will use id
if name
is not available.
That said, we should probably just make it required since it's useful as a display name in our tooling and it's provided by default in our devcontainers/feature-starter
template.
One thing to note - if we add name
as required in the schema for Features, this validation code when publishing with the devcontainers/action
will fail if the Feature is missing name
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems safer to update the spec to make it optional then. We could break existing features as you point out.
One advantage of not making it required is that it is easier to write one-off features for prototyping or testing. We would still want features going into the index to have good names for the UI. 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Looks great overall, I have left a few comments for consideration / discussion.
We should then also update https://github.com/devcontainers/action to use this schema similarly to how it uses the schema for features.
We could add the features and templates schemas to VS Code like we do for the main schema here: https://github.com/microsoft/vscode/blob/75b1639461b53dc51380a61532aabdd502c4c718/extensions/configuration-editing/package.json#L142
El jue., 21 de diciembre de 2023 1:47 p. m., Ben Blank <
***@***.***> escribió:
… ***@***.**** commented on this pull request.
------------------------------
In schemas/devContainerTemplate.schema.json
<#350 (comment)>:
> @@ -0,0 +1,182 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Development Container Template Metadata",
+ "description": "Development Container Template Metadata (devcontainer-template.json). See https://containers.dev/implementors/templates/ for more information.",
+ "definitions": {
+ "Template": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "$schema": {
I just pushed a new commit to the PR which adds this.
—
Reply to this email directly, view it on GitHub
<#350 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A65ALOP2JMICH4CDYRD6QGDYKSG6NAVCNFSM6AAAAABAUKUTBCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOOJTGU3TAOBWGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
- The schema for features has been updated to use "oneOf" semantics instead of "anyOf" semantics for option types. (This should have no practical effect, but clarifies intent.) - For templates, the schema no longer requires a string option to have "proposals" when "enum" is absent. (This matches the behavior of the features schema.)
I'm going to be honest I am researching who or what and why I am getting
repositories i don't have any idea how and im experiencing lotsbof abnormal
iterference on my and. Droid devices so I have no clue I need assistance or
help to identify why my devices have like gecko HTML
…On Tue, Jan 30, 2024, 9:29 AM Josh Spicer ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In schemas/devContainerTemplate.schema.json
<#350 (comment)>:
> + "items": {
+ "type": "string"
+ }
+ },
+ "publisher": {
+ "description": "Name of the publisher/maintainer of the Template.",
+ "type": "string"
+ },
+ "version": {
+ "description": "The semantic version of the Template.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "id",
+ "name",
In the tooling name is not required. For example when we build the
READMEs in devcontainers/action it will use id if name is not available.
That said, we should probably just make it required since it's useful as a
display name in our tooling
One thing to note - if we add name as required in the schema for
Features, this validation
<https://github.com/devcontainers/action/blob/main/src/utils.ts#L119>
code when publishing with the devcontainers/action will fail if the
Feature is missing name.
—
Reply to this email directly, view it on GitHub
<#350 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BENKNRHXV5257PEGK7WF46TYRENWRAVCNFSM6AAAAABAUKUTBCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNJRG44DEMZVGU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I've made an attempt at creating the JSON schema for Template metadata which I requested in #349.
Some notes:
devContainerFeature.schema.json
, on the theory that Template metadata has more in common with Feature metadata than it does Development Container metadata.id
,name
, andversion
are required for Feature metadata, I've assumed those same three properties are required for Template metadata.enum
andproposals
; see the points below).default
property may only be a string, I've assumed that it should instead be a boolean when thetype
property is"boolean"
.enum
andproposals
properties of options:enum
norproposals
are relevant to boolean options, so have forbidden them.enum
cannot be an empty array, on the theory that because free-form values are not allowed, it would make it impossible to set a valid value for that option.proposals
, as free-form values are allowed.Apologies for the verbose description; I'm only getting started with Development Containers and want to make sure that any mistakes I've made are easy to spot. 😅