Code Monkey home page Code Monkey logo

address's People

Contributors

cjihrig avatar engineforce avatar greenkeeper[bot] avatar hueniverse avatar kanongil avatar marsup avatar nkint avatar patrykcieszkowski avatar sebastinto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

address's Issues

Email validations rejects valid email addresses

Support plan

  • is this issue currently blocking your project? (yes/no): yes
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 10.22.1
  • module version with issue: 17.3.0
  • last module version without issue: NA
  • environment (e.g. node, browser, native): NodeJs
  • used with (e.g. hapi application, another framework, standalone, ...): ExpressJs
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

We are trying to verify emails using Joi. Following snippet demonstrates the way we are using Joi. The variable failingPayload contains the email address which Joi rejects. The email domain "dpllp.cpa" is valid

const joiSchema = Joi.object({
    emailAddress: Joi.string().email().required(),
  });
const failingPayload = {
  emailAdress: "[email protected]"
};
Joi.assert(failingPayload, joiSchema)

What was the result you got?

We got validation error stating that the email address is invalid.

What result did you expect?

Since this email is valid. We expect Joi to pass this validation.

Additional Information

Looking at the API docs (here), we figured out that this validation uses IANA TLD list. However, the TLD CPA is present in (IANA TLD Directory)

Revert Url hack

Reverting #4 as it increases bundle size by 12K. Basically, the node Url shim it pretty big and includes punycode anyways so this saves nothing for now.

Invalid input error validating link in schema

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 14.16.0
  • module version with issue: 17.3.0
  • last module version without issue:
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): celebrate
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

As discussed in the celebrate repo under issue #222, I'm getting an error when trying to validate a link inside my schema. I have detailed all the code I'm running under the celebrate issue, so if you guys need to see the code I suggest you link to that issue. This is the schema I'm referring to:

link: Joi.string()
   .uri({
      domain: {
         tlds: {
            allow: true,
         },
      },
   })
   .required()

And this is the content I'm trying to validate:

http:/instagram.com or http:instagram.com

So the issue I've been having with this is that whenever I try to pass on an invalid uri like the ones from the example above (missing a forward slash or both) I get an invalid input error.

What was the result you got?

This is the error message I got:

Error: Invalid input: domain must be a string
    at Object.exports.analyze (/Users/dev/Documents/Projetos/backend/node_modules/@sideway/address/lib/domain.js:21:15)
    at Object.exports.isValid (/Users/dev/Documents/Projetos/backend/node_modules/@sideway/address/lib/domain.js:101:21)
    at Object.validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/types/string.js:653:33)
    at Object.internals.rules (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/validator.js:394:33)
    at Object.exports.validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/validator.js:350:22)
    at internals.Base.$_validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/base.js:773:26)
    at Object.validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/types/keys.js:108:45)
    at Object.exports.validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/validator.js:325:26)
    at internals.Base.$_validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/base.js:773:26)
    at Object.validate (/Users/dev/Documents/Projetos/backend/node_modules/joi/lib/types/array.js:273:45)

What result did you expect?

I expect the library to identify my input as a wrong domain format and validate it accordingly giving me back a validation message instead of an error.

Support option to allow longer email addresses

Hi,

Atm we use Joi 14 which uses isEmail to validate email addresses.
We use it like this: Joi.string().email({ errorLevel: 68 }).
As you can see we use the errorLevel to make the validation more relaxed, mainly for long email addresses.
Now the upgrade to a newer Joi version replaced isEmail with this module leaving us with no 'out of the box' option to migrate our email validation without breaking it.
I understand that this module tries to validate to spec as much as possible for our use case this strictness is just a bit too much (sadly :P).
The spec also states 4.5.3.1. Size Limits and Minimums [...] To the maximum extent possible, implementation techniques that impose no limits on the length of these objects should be used.
Would you consider an option to allow longer addresses and then exposing said option through Joi.email()?
I think it is mostly around this line https://github.com/hapijs/address/blob/master/lib/index.js#L98
If you want I can submit a PR for this.

build-int tlds list vanished during typescript update

Context

  • node version: 18.17.1
  • module version: 5.1.1

What are you trying to achieve or the steps to reproduce ?

This module is very confusing. We used older version 4.1.0 of @hapi/address for build-in tlds list. Now that we make upgrade to the latest version 5.1.1 this tlds list is just gone! There no mention about it, aside of in here but without any reference to commit or PR. It just states

Remove built-in TLDS list support (moved to new @sideway/tlds module)

but such package not exists in npm! After some digging I finally found tlds list was removed in this commit

Also I noticed that in npm present @sideways/address 5.0.0 It looks like joi have some fight with hapi, your own business, but please do update documentation properly and explain where things going, why and which are latest and correst modules, and in old and deprecated ones state that they are deprecated, it is a mess now!

Export errors codes to allow translation

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Free support
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: v12.11.1
  • module version: latest
  • environment (e.g. node, browser, native): browser
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information: Typescript 3.6.2

What problem are you trying to solve?

Hi, thanks for the template and the code of conduct - very inspirational words. Hope everything will be ok with this issue.

I'd like to use this address module: it is very exhaustive and I love the detailed feedback it gives back in case of error.

But I also need to translate error codes so I would like to have a list of all errors used and / or error codes. In my case have a translation/error-codes is mandatory and can compromise to use or not this library.

Do you have a new or modified API suggestion to solve the problem?

I'm here to discuss what is the best way to do it (if this can be a good idea for the maintainer) and hopefully find the time to have a mini pull-request.

One idea can be:

const errorsByCode = {
    BE_STRING: 'Invalid input: email must be a string',
	BE_NON_EMPTY_STRING: 'Address must be a non-empty string',
    // ....
};

module.exports = {
	errorsByCode,
    domain: {
        // ....
    },
    email: {
        // ....       
    }
};

// use the error-codes in the rest of the source code

What do you think?

Change API

  • Remove all namespaces and export all APIs directly on the module root
  • Remove built-in TLDS list support (moved to new @sideway/tlds module)

domain.analyze reporting "invalid" for valid domains

Support plan

  • which support plan is this issue covered by? Community
  • is this issue currently blocking your project? no
  • is this issue affecting a production system? yes

Context

  • node version: any (but checked on 12.16.3 LTS)
  • module version with issue: 4.0.1
  • last module version without issue: none
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...):standalone
  • any other relevant information: no

What are you trying to achieve or the steps to reproduce?

I am trying to validate the following email provided by a customer (hello@1global). While not common, it is a valid email without a tld that starts with a digit. This is how the domain is verified:

domain.analyze('1global', {minDomainSegments: 1, tlds: false})
// { error: 'Domain contains invalid character' }

What was the result you got?

The domain 1global was invalid, and therefore the email hello@1global was invalid as well

What result did you expect?

I expected the domain 1global to be valid with the provided options, and therefore the email hello@1global to be valid as well.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Not all valid emails are accepted by the `isValid` method (utilized by Joi)

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: v13.11.0
  • module version with issue: v4.0.1
  • last module version without issue: Unknown
  • environment (e.g. node, browser, native): Node
  • used with (e.g. hapi application, another framework, standalone, ...): Joi
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

Route definition:

server.route({
	method: "POST",
	path: "/register",
	options: {
		validate: {
			payload: {
				user: Joi.string().email().required(),
				password: Joi.string().min(8).required()
			}
		},
	},
	handler: async (request, h) =>
	{
		return "Got here";
	}
});

Request:

POST /register HTTP/1.1
Host: localhost:3000
User-Agent: curl/7.64.1
Accept: */*
Content-Type: application/json
Content-Length: 52

{"user":"\"one\"@email.com","password":"longenough"}

What was the result you got?

{"statusCode":400,"error":"Bad Request","message":"Invalid payload input"}

Using [email protected] instead of "one"@email.com works as expected

What result did you expect?

Got here

Missing v1-commercial API file

Context

  • node version: 10.15.3
  • module version: 1.0.0

What are you trying to achieve or the steps to reproduce ?

V1-Commercial branch is missing API.md file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.