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

json schema for protocol #40

Closed
wants to merge 1 commit into from
Closed

Conversation

gorkem
Copy link
Contributor

@gorkem gorkem commented Jul 22, 2016

A Json schema that is mostly generated from protocol.d.json

@msftclas
Copy link

Hi @gorkem, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@nojvek
Copy link

nojvek commented Jul 23, 2016

Pretty awesome that this confirms to the json schema definition.

Could you link the Java generator ?

@gorkem
Copy link
Contributor Author

gorkem commented Jul 25, 2016

the pom.xml that generates java model from json schema https://github.com/gorkem/java-language-server/blob/master/server/lang-protocol-generator/pom.xml

@dbaeumer
Copy link
Member

@gorkem: nice work. Thanks a lot. Before we merge this in I have a couple of questions / suggestions:

  • do you know of any tool to create a ts file from a schema.
  • and shouldn't we group the json schema a little bit. What I mean is that everything for a request is at one place?
  • and it looks like enums are translated wrongly if they have assigned numbers. An example is MessageType which is in the schema:
"MessageType": { 
    "type": "string" 
}, 

but in TS

/**
 * The message type
 */
export enum MessageType {
    /**
     * An error message.
     */
    Error = 1,
    /**
     * A warning message.
     */
    Warning = 2,
    /**
     * An information message.
     */
    Info = 3,
    /**
     * A log message.
     */
    Log = 4
}
  • looks like we lost comments as well (especially all the interface comments)
  • Request and Notification type definitions aren't included either. Example is: ShutdownRequest

Did you generate the file with a tool. May be we can tweak it a little for our purpose.

@dbaeumer
Copy link
Member

@gorkem and you need to sign the CLA (see #40 (comment)). Otherwise I can't merge it in.

@svenefftinge
Copy link
Contributor

@gorkem are you going to sign the CLA and work on the things @dbaeumer mentioned? We would like to use this as the source for our code generator in https://github.com/TypeFox/ls-api

@gorkem
Copy link
Contributor Author

gorkem commented Sep 20, 2016

@svenefftinge Unfortunately, we needed a CCLA so this is waiting on that.

@felixfbecker
Copy link

@dbaeumer I only know about the other way: https://github.com/YousefED/typescript-json-schema

@@ -0,0 +1,1216 @@
{
"type": "object",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this really be an object? Shouldn't the schema only define all structures?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is something that the generator tool created. We should remove it going forward.

A Json schema that is mostly generated from protocol.d.json
@gorkem
Copy link
Contributor Author

gorkem commented Dec 13, 2016

@dbaeumer I should have a CLA now, is there a way to check it has gone in effect?

@dbaeumer
Copy link
Member

dbaeumer commented Feb 8, 2017

@gorkem usually the cla label is updated by the cla bot. Let me see what is missing here.

@dbaeumer
Copy link
Member

dbaeumer commented Feb 8, 2017

Looks like closing and reopening should trigger a revalidate. Let me see if it works.

@dbaeumer
Copy link
Member

dbaeumer commented Feb 8, 2017

OK. Here we go.

Instead of simply applying this PR I think we also need to work on a tool chain to generate the schema from the protocol.ts file here: https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/protocol.ts

Maintaining the schema by hand will be a nightmare and I don't want to make json schema the master :-)

@gorkem which tool did you use to generate the JSON schema.

@gorkem
Copy link
Contributor Author

gorkem commented Feb 9, 2017

I have used typescript-json-schema . It needs to be massaged in some cases but works most of the time. I also have a Gruntfile I used that automates things which I can share.

@dbaeumer
Copy link
Member

dbaeumer commented Feb 9, 2017

Great. Can you attach it here?

@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Apr 12, 2017
@dbaeumer dbaeumer added this to the 4.0 milestone Apr 12, 2017
@microsoft microsoft deleted a comment from msftclas Sep 27, 2017
@dbaeumer dbaeumer modified the milestones: 4.0, Backlog Oct 30, 2019
@dbaeumer
Copy link
Member

dbaeumer commented Mar 2, 2021

I will close the PR. If we want a json schema we should invest in some automation.

@dbaeumer dbaeumer closed this Mar 2, 2021
@dbaeumer dbaeumer removed this from the Backlog milestone Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants