diff --git a/go/messages.go b/go/messages.go index fbb173d4..43ee53b8 100644 --- a/go/messages.go +++ b/go/messages.go @@ -252,9 +252,9 @@ type PickleTag struct { } type Source struct { - Uri string `json:"uri"` - Data string `json:"data"` - MediaType SourceMediaType `json:"mediaType"` + Uri string `json:"uri"` + Data string `json:"data"` + MediaType string `json:"mediaType"` } type SourceReference struct { @@ -413,24 +413,6 @@ func (e PickleStepType) String() string { } } -type SourceMediaType string - -const ( - SourceMediaType_TEXT_X_CUCUMBER_GHERKIN_PLAIN SourceMediaType = "text/x.cucumber.gherkin+plain" - SourceMediaType_TEXT_X_CUCUMBER_GHERKIN_MARKDOWN SourceMediaType = "text/x.cucumber.gherkin+markdown" -) - -func (e SourceMediaType) String() string { - switch e { - case SourceMediaType_TEXT_X_CUCUMBER_GHERKIN_PLAIN: - return "text/x.cucumber.gherkin+plain" - case SourceMediaType_TEXT_X_CUCUMBER_GHERKIN_MARKDOWN: - return "text/x.cucumber.gherkin+markdown" - default: - panic("Bad enum value for SourceMediaType") - } -} - type StepDefinitionPatternType string const ( diff --git a/java/src/generated/java/io/cucumber/messages/types/Source.java b/java/src/generated/java/io/cucumber/messages/types/Source.java index 370e84f9..26f902bb 100644 --- a/java/src/generated/java/io/cucumber/messages/types/Source.java +++ b/java/src/generated/java/io/cucumber/messages/types/Source.java @@ -20,12 +20,12 @@ public final class Source { private final String uri; private final String data; - private final SourceMediaType mediaType; + private final String mediaType; public Source( String uri, String data, - SourceMediaType mediaType + String mediaType ) { this.uri = requireNonNull(uri, "Source.uri cannot be null"); this.data = requireNonNull(data, "Source.data cannot be null"); @@ -51,7 +51,7 @@ public String getData() { * The media type of the file. Can be used to specify custom types, such as * text/x.cucumber.gherkin+plain */ - public SourceMediaType getMediaType() { + public String getMediaType() { return mediaType; } diff --git a/java/src/generated/java/io/cucumber/messages/types/SourceMediaType.java b/java/src/generated/java/io/cucumber/messages/types/SourceMediaType.java deleted file mode 100644 index 9ecc2333..00000000 --- a/java/src/generated/java/io/cucumber/messages/types/SourceMediaType.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.cucumber.messages.types; - -// Generated code -@SuppressWarnings("unused") -public enum SourceMediaType { - - TEXT_X_CUCUMBER_GHERKIN_PLAIN("text/x.cucumber.gherkin+plain"), - - TEXT_X_CUCUMBER_GHERKIN_MARKDOWN("text/x.cucumber.gherkin+markdown"); - - private final String value; - - SourceMediaType(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - public String value() { - return this.value; - } - - public static SourceMediaType fromValue(String value) { - for (SourceMediaType v : values()) { - if (v.value.equals(value)) { - return v; - } - } - throw new IllegalArgumentException(value); - } -} diff --git a/javascript/src/messages.ts b/javascript/src/messages.ts index d6df2b31..a7c07971 100644 --- a/javascript/src/messages.ts +++ b/javascript/src/messages.ts @@ -471,7 +471,7 @@ export class Source { data: string = '' - mediaType: SourceMediaType = SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_PLAIN + mediaType: string = '' } export class SourceReference { @@ -677,11 +677,6 @@ export enum PickleStepType { OUTCOME = 'Outcome', } -export enum SourceMediaType { - TEXT_X_CUCUMBER_GHERKIN_PLAIN = 'text/x.cucumber.gherkin+plain', - TEXT_X_CUCUMBER_GHERKIN_MARKDOWN = 'text/x.cucumber.gherkin+markdown', -} - export enum StepDefinitionPatternType { CUCUMBER_EXPRESSION = 'CUCUMBER_EXPRESSION', REGULAR_EXPRESSION = 'REGULAR_EXPRESSION', diff --git a/jsonschema/Source.json b/jsonschema/Source.json index 61ca46ee..278e3f6a 100644 --- a/jsonschema/Source.json +++ b/jsonschema/Source.json @@ -19,11 +19,7 @@ }, "mediaType": { "description": "The media type of the file. Can be used to specify custom types, such as\n text/x.cucumber.gherkin+plain", - "type": "string", - "enum": [ - "text/x.cucumber.gherkin+plain", - "text/x.cucumber.gherkin+markdown" - ] + "type": "string" } }, "type": "object" diff --git a/messages.md b/messages.md index 8c89a599..be75131f 100644 --- a/messages.md +++ b/messages.md @@ -330,7 +330,7 @@ will only have one of its fields set, which indicates the payload of the message | ----- | ---- | ----------- | ----------- | | `uri` | string | yes | | | `data` | string | yes | | -| `mediaType` | [SourceMediaType](#sourcemediatype) | yes | | +| `mediaType` | string | yes | | ## SourceReference @@ -502,14 +502,6 @@ One of the following: * `"Outcome"` -## SourceMediaType - -One of the following: - -* `"text/x.cucumber.gherkin+plain"` -* `"text/x.cucumber.gherkin+markdown"` - - ## StepDefinitionPatternType One of the following: diff --git a/perl/lib/Cucumber/Messages.pm b/perl/lib/Cucumber/Messages.pm index b9422498..ed97ba4c 100644 --- a/perl/lib/Cucumber/Messages.pm +++ b/perl/lib/Cucumber/Messages.pm @@ -3236,7 +3236,7 @@ use Scalar::Util qw( blessed ); my %types = ( uri => 'string', data => 'string', - media_type => '', + media_type => 'string', ); # This is a work-around for the fact that Moo doesn't have introspection @@ -3280,29 +3280,12 @@ has data => The media type of the file. Can be used to specify custom types, such as text/x.cucumber.gherkin+plain - -Available constants for valid values of this field: - -=over - -=item * MEDIATYPE_TEXT_X_CUCUMBER_GHERKIN_PLAIN - -=item * MEDIATYPE_TEXT_X_CUCUMBER_GHERKIN_MARKDOWN - -=back - =cut - -use constant { - MEDIATYPE_TEXT_X_CUCUMBER_GHERKIN_PLAIN => 'text/x.cucumber.gherkin+plain', - MEDIATYPE_TEXT_X_CUCUMBER_GHERKIN_MARKDOWN => 'text/x.cucumber.gherkin+markdown', - }; - has media_type => (is => 'ro', required => 1, - default => sub { MEDIATYPE_TEXT_X_CUCUMBER_GHERKIN_PLAIN }, + default => sub { '' }, ); diff --git a/php/src-generated/Source.php b/php/src-generated/Source.php index 1cc00120..b2b812cf 100644 --- a/php/src-generated/Source.php +++ b/php/src-generated/Source.php @@ -43,7 +43,7 @@ public function __construct( * The media type of the file. Can be used to specify custom types, such as * text/x.cucumber.gherkin+plain */ - public readonly Source\MediaType $mediaType = Source\MediaType::TEXT_X_CUCUMBER_GHERKIN_PLAIN, + public readonly string $mediaType = '', ) { } @@ -61,7 +61,7 @@ public static function fromArray(array $arr): self return new self( (string) $arr['uri'], (string) $arr['data'], - Source\MediaType::from((string) $arr['mediaType']), + (string) $arr['mediaType'], ); } diff --git a/php/src-generated/Source/MediaType.php b/php/src-generated/Source/MediaType.php deleted file mode 100644 index e5968a04..00000000 --- a/php/src-generated/Source/MediaType.php +++ /dev/null @@ -1,15 +0,0 @@ -