Giter Site home page Giter Site logo

Comments (2)

dpopp07 avatar dpopp07 commented on September 25, 2024

Thanks for the issue. I think I agree that should be acceptable camel case. I'll need to change our regex that we use to determine conformance.

from openapi-validator.

mkistler avatar mkistler commented on September 25, 2024

This is a tricky one. The general issue here is how to treat words that are a single character. In the example given, the single character word comes at the end, but it wouldn't have to -- what should be the camelCase for "is_a_dog"? You might say that it should be "isADog", but this has two adjacent capital letters, which also fails our standard camelCase regex's.

Given that there are only two valid single letter words in the English language ("a", and "I"), it might be possible to write a regex that allows for this, but disallows all other occurrences of adjacent capital letters. And also allows either of these two to appear "bare" at the end of the string.

Here's an attempt:

> var exp = /^[a-z][a-z0-9]*([AI]{0,1}[A-Z][a-z0-9]+)*[AI]{0,1}$/
undefined
> exp.test("isA")
true
> exp.test("isADog")
true
> exp.test("isAADog")
false
> 

@nrail-joerg-walter Does this look like it would meet your needs?

from openapi-validator.

Related Issues (20)

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.