This repository was archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
💔 |
1 similar comment
💔 |
ce21ae0
to
6a5aada
Compare
❤️ |
6a5aada
to
2eb9130
Compare
❤️ |
This was referenced Oct 13, 2015
if(block.opener) { | ||
content += this.getIndentation(indentSize); | ||
content += SwaggerCodePrinter.END_BLOCK_CHAR; | ||
content += block.endingCharacter ? block.endingCharacter : ''; |
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.
block.endingCharacter || ''
Used for extracting messages out of given .json files. If given a key be it simple (Some_error_message) or complex (iOS.iTunes.Connection_Refused_Error) should return a message if one is found in any given file. If no value is found returns the key itself. Given .json files are prioritized - that is to say if a key is found in the first file it is immediately returned. That way messages can be overriden - for example appbuilder.messages.json may override keys from common.messages.json
That way an interface (IMessages) and an implementation file is generated which can be used for autocompletion when accessing JSON-predefined error messages. Includes a bit of refactoring - extracting some classes from swagger into common. Usage of the new messages service can be seen in `devices-services` class I'm committing the first draft of messages.d.ts and messages.ts which will hopefully grow in the future.
Covering all the basic scenarios.
2eb9130
to
cf8b7c7
Compare
💔 |
❤️ |
Addressed all issues, ping @teobugslayer @Fatme and @rosen-vladimirov for a second review |
👍 |
Mitko-Kerezov
added a commit
that referenced
this pull request
Nov 16, 2015
Restructure error messaging
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References #300626
Introduces a new messaging service which reads messages from given .json files. There is one such file placed in this library and is loaded by default. Its keys can be overriden by providing other, client-specific .json files containing the same keys but with a different value.
In order to achieve autocompletion on referencing these error messages a new generation command is introduced - dev-generate-messages. It produces a .d.ts interface, as well as a .ts implementation file, which contain all keys from all provided json files as properties. If run as-is it generates files for the client from which the command is launched. If
--default
option is provided generates messages in common lib only.In order to apply this change I've moved some of the code-generation logic related to AppBuilder-CLI's swagger here. The only change other than physically moving these files is the introduction of a non-mandatory field -
endingCharacter?: string;
- needed in order to generate Typescript properties more aestheticallySample usage of this whole effort can be seen in
devices-services.ts
file in this PR.