npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

swagger-validations-next

v0.1.1

Published

Npm package for vue 2.0 for validating forms via swagger 3.0

Downloads

3

Readme

swagger-validations-next v1.0

Npm package for vue 2.0 for validating forms via swagger 3.0

swagger-validations v1.0 for vue 2

https://github.com/scisa-mx/swagger-validations

Getting Started

This package has mainly two uses.

  1. Generate the form via swagger and use the validations inside
  2. Provide the form that will be validated within the swagger validation

Dependencies

  1. Axios
  2. "swagger-object-validator": "^1.4.5"
  3. "bootstrap": "^5.3.3"

Import to project globaly

main.ts ´´´ import swaggerValidationsNext from 'swagger-validations-next' const appInstance = createApp(App); swaggerValidationsNext(appInstance) ´´´

Usage

Start by initializing the swagger file that will be used for the validations This must be run before using any form validator Right now it only works by getting a swagger file from an url, it does not support a local swagger file

## App.vue
import { initializeValidations } from 'swagger-validations'

export default {
    initializeValidations(axiosInstance, `https://localhost:5001/swagger/v1/swagger.json`)
}

After init you can use either validations

Form Generator Validator

The model is the object that will be validated The spec is the name inside the swagger which the object will be validated against if-valid is the function that will be submited (Callback) the update is needed to update the model when changes occur when the user inputs

<template>
    <form-generator-validator
        :model="band"
        spec="SpidClasifTransTypeDTO_V2"
        :if-valid="onSubmit"
        @update:value="value = $event"
    />
</template>

<script>
import FormGeneratorValidator from 'swagger-validations'
export default {
  components: {
    FormGeneratorValidator,
  },
}
</script>

Form Validator

TODO: Missing docs The spec is the name of the object in swagger which the model will be validated against if-valid is the callback function that will be called after submitting the form Model is the object that will be validated

<template>

    <form-validator
        :spec="'AddressDTO_V2'"
        :if-valid="saveAddress"
        :model="dataToValidate"
        :validate="validate"
        :inside-component="false"
    >

        <b-button
            size="sm"
            variant="primary"
            @click="submitForm"
        >
            Submit
        </b-button>
    </form-validator>
</template>
<script>

import { FormValidator } from 'swagger-validations'
export default {
  components: {
    FormValidator,
  },
}

</script>

Local usage

  1. Generate the package with npm pack

Usando el paquete

  1. Antes de usar cualquier validacion se tiene que llamar el initializeValidations de formValidations.js

Publicar paquete

  1. npm login
  2. npm publish