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

Migration doesn't appear to support prohibitRegexp #145

Closed
wilsondy opened this issue Jun 13, 2019 · 5 comments
Closed

Migration doesn't appear to support prohibitRegexp #145

wilsondy opened this issue Jun 13, 2019 · 5 comments

Comments

@wilsondy
Copy link

Expected Behavior

I should be able to modify content models from the tool even if they contain regex validations.

Actual Behavior

Error message displayed during content migration if a regex is enabled:
"Error: A field can't have "prohibitRegexp" as a validation."

Possible Solution

Steps to Reproduce

  1. Create the following in the UI:
    image

  2. Create a content type migration and attempt to run it.
    e.g.

function addTranslations (contentType) {
        const ct =  migration.editContentType(contentType);
        ct.createField('translations')
            .name('Translations')
            .type('Text')
            .localized(false)
            .required(false);
   

        ct.changeEditorInterface('translations', 'multipleLine',
        {helpText: 'Add json for all necessary translations'}
    );
    }
  1. Fail due to error shown above.
The following migration has been planned

Environment: ci

Update Content Type contentTag

  Create field translations
    - name: "Translations"
    - type: "Text"
    - localized: false
    - required: false


Error: A field can't have "prohibitRegexp" as a validation.

Context

standard content model migration tasks.

Workaround

Manually uncheck prohibit regex and run migration.
I haven't tested any other of the checkboxes, so other errors might be lurking.

Environment

node -v v12.1.0
npm -v 6.9.0
Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

@wilsondy
Copy link
Author

wilsondy commented Jul 2, 2019

We've found this appears to also cause issues if we use C# client to modify content that use the validation. The Client fails and throws a nasty exception. This is becoming a more challenging issue for us.

@wilsondy
Copy link
Author

wilsondy commented Jul 2, 2019

   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at Contentful.Core.Configuration.ValidationsJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in C:\projects\contentful.net\contentful.core\Configuration\ValidationsJsonConverter.cs:line 145
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject[T](JsonSerializer jsonSerializer)
   at Contentful.Core.ContentfulManagementClient.GetContentType(String contentTypeId, String spaceId, CancellationToken cancellationToken) in C:\projects\contentful.net\contentful.core\ContentfulManagementClient.cs:line 227
   at Contentful.Core.ContentfulManagementClient.UpdateEntryForLocale(Object entry, String id, String locale, String spaceId, CancellationToken cancellationToken) in C:\projects\contentful.net\contentful.core\ContentfulManagementClient.cs:line 625

@phoebeschmidt
Copy link
Contributor

Hey @wilsondy thanks for following up.

Seems like this is a bug in the contentful-migration tool. We will work on adding this validation.

Can you please open another ticket with details about what you're experiencing on the .NET sdk here: https://github.com/contentful/contentful.net. Thanks for your patience!

@dad045
Copy link

dad045 commented Jul 3, 2019

done... contentful/contentful.net#183

@phoebeschmidt
Copy link
Contributor

This fix has been released as part of contentful-migration v0.19.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants