Giter VIP home page Giter VIP logo

oas-commons's Introduction

OAS TOOLS

NPM

npm node-current npm Node.js CI Conventional Commits

Known Vulnerabilities Coverage Status

Warning

OAS Tools package has been renamed from oas-tools to @oas-tools/core

Quickstart

Initialize a new OAS Tools project from the CLI

> npx @oas-tools/cli init

It will prompt the following menu, asking which type of resource will be initialized:

? Select a resource to initialize (Use arrow keys)
> Server
  Module
  Development environment
  OpenAPI File

Select server, answer the questions and you'll get a running server with OAS Tools.

More information in our web page

Contributing guidelines

We greatly appreciate community contributions, that's why we have created a document stating clear guidelines for contributing to OAS Tools. We also encourage you to participate in discussions and activate notification for our announcements in the organization's discussions dashboard

License

Copyright 2018, ISA Group, University of Sevilla

For technical inquiry please contact to engineering team.

ISA Group

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

oas-commons's People

Contributors

alesancor1 avatar pebo avatar

Watchers

 avatar

Forkers

pebo rurikromanov

oas-commons's Issues

[BUG] Validator fails when response description is missing in API document

Hello,

First of all, thanks for the great library ๐Ÿ‘

Bug description

The oas-tools validator fails with an obscure message when the field "description" is missing in any "responses" field of the API document.
[oas-tools] ERROR: TypeError: s.replaceAll is not a function

To Reproduce

Steps to reproduce the behavior:

  1. Initialize a project of type "server" with the following API file and the default configuration
openapi: "3.1.0"
info:
  version: 1.0.0
  title: Sample API
servers:
  - url: http://localhost:9876
paths:
  /test:
    x-router-controller: controller
    get:
      operationId: test
      responses:
        200:
          description: Sample description  # <--- Line to remove
          content:
            application/json:    
              schema:
                type: object
  1. Run the server with npm start. No error appears
  2. Remove the "description" line in the API file
  3. Run the server again. The following error appears:
2022-09-24 18:09:83 [oas-tools] ERROR: TypeError: s.replaceAll is not a function
    at _____\node_modules\@oas-tools\commons\dist\utils\modules\validator.js:40:131

Expected behavior

The validator should ignore the missing field, or give a clearer message about the missing field

According to the OAS spec, the description field is optional:

Operations also support some optional elements for documentation purposes:

  • A short summary and a longer description of what an operation does. description can be multi-line and supports Markdown for rich text representation.
  • ...

https://swagger.io/docs/specification/paths-and-operations/

@oas-tools/commons 1.0.1 typings broken

Describe the bug

The content of index.d.ts is broken in the @oas-tools/commons v1.0.1 module:

node_modules/@oas-tools/commons/dist/index.d.ts
export * from "./middleware/index.js";
export * from "./utils/index.js";
export CHANGELOG.md LICENSE README.md dist node_modules package-lock.json package.json schemas src tsconfig.json typings from ../typings

The last line should not be there. The line was likely added by the build target in package.json which seem to include some early work on typescript migration:

    "build": "tsc && cp src/index.mjs dist/index.mjs && echo export * from '../typings' >> dist/index.d.ts",

To Reproduce

Steps to reproduce the behavior:

yarn build

Errors:

../../node_modules/@oas-tools/commons/dist/index.d.ts:3:1 - error TS1128: Declaration or statement expected.

3 export CHANGELOG.md LICENSE README.md dist node_modules package-lock.json package.json schemas src tsconfig.json typings from ../typings

...etc

Expected behavior

No extract lines in index.d.ts.

Screenshots

n/a

Desktop (please complete the following information):

n/a

Smartphone (please complete the following information):

n/a

Additional context

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.