0

I have very strange behavior in my Nest.js application with dynamoose. This is my location schema:

import { NULL, Schema } from 'dynamoose';

export const LocationSchema = new Schema({
  country: String,
  city: String,
  zipCode: String,
  companyName: {
    type: [String, NULL],
    default: null,
  },
  streetAddress: {
    type: [String, NULL],
    default: null,
  },
  contactPhone: {
    type: [String, NULL],
    default: null,
  },
  contactEmail: {
    type: [String, NULL],
    default: null,
  },
});

In body I'm posting this:

"deliveryLocation":{"country":"United Kingdom","zipCode":"M11 9","city":"MANCHESTER AIRPORT"},"pickupLocation":{"country":"Belgium","zipCode":"1020","city":"BRUXELLES/BRUSSEL 2"}

And I got ValidationException: A value provided cannot be converted into a number

As you can see any property has type Number.

What is even more strange if I change in deliveryLocation zipCode to M119 it is valid for DynamoDB.

If I'm changing in deliveryLocation United Kingdom to 'United Kindon' and let zipCode stay 'M11 9' the error is not coming.

If I making request with same values in deliveryLocation and pickupLocation - {"country":"United Kingdom","zipCode":"M11 9","city":"MANCHESTER AIRPORT"} - there is also no error.

To sum up error occurs only in this combination

"deliveryLocation":{"country":"United Kingdom","zipCode":"M11 9","city":"MANCHESTER AIRPORT"},"pickupLocation":{"country":"Belgium","zipCode":"1020","city":"BRUXELLES/BRUSSEL 2"}

Any idea why it is happening?

I tried adding to schema

saveUnknown: true,

but it is not solving the problem.

0 Answers0