Open
Conversation
| export class HttpImporter extends Importer { | ||
|
|
||
| //TODO RuntimeParameters type is probably wrong | ||
| parameters:ImporterParameterDescription[] = [new ImporterParameterDescription({name:"location", description:"String of the URI for the HTTP call", type:"string"}), |
Collaborator
There was a problem hiding this comment.
Alternative design idea:
Use an interface instead of a class for parameter descriptions (since no behavior, just plain data)
TypeScript
export interface ImporterParamDescription {
name: string;
description: string;
type: string;
}
Use a record ("as a map"). Not sure if we need this though.
```TypeScript
parameters: Record<string, ImporterParamDescription> = {
'location': {
name: 'location',
description: '....',
type: 'string'
}
}
| illegalArgumentsMessage = illegalArgumentsMessage + this.type + "importer requires parameter " + requiredParameter.name + "\n"; | ||
| } | ||
| // TODO is that OK? | ||
| else if((inputParameters.get(requiredParameter.name) as any).constructor.name != requiredParameter.type){ |
Collaborator
There was a problem hiding this comment.
That looks weird. What are you trying to compare here?
| //TODO @Georg: need to check how to store the class in typescript, can use instance.constructor.name to get the name probably -> is stored as string | ||
| type: unknown; | ||
|
|
||
| constructor ({name,description,required=true,type}: {name:string, description:string, required?:boolean, type:unknown}) { |
Collaborator
There was a problem hiding this comment.
ImporterParameterDescription sould be a simple interface since no behavior
| import { HttpImporter } from "../../importer/HttpImporter"; | ||
| import { Importer } from "../../importer/Importer"; | ||
|
|
||
| export class Protocol { |
Collaborator
There was a problem hiding this comment.
I think having this construct does not make sense in TypeScript.
rather just
export Protocol = {
HTTP: new HttpImporter()
}
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.