# K6 Build chaijs with OpenApi validator

**URL:** <https://community.grafana.com/t/k6-build-chaijs-with-openapi-validator/124931>\
**Category:** OSS Support\
**Tags:** plugins\
**Created:** [June 27, 2024, 9:05am UTC](https://community.grafana.com/t/k6-build-chaijs-with-openapi-validator/124931 "2024-06-27T09:05:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![beagomezguillermo](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@beagomezguillermo](https://community.grafana.com/u/beagomezguillermo)\
**Post date:** [June 27, 2024, 9:05am UTC](https://community.grafana.com/t/k6-build-chaijs-with-openapi-validator/124931/1 "2024-06-27T09:05:42Z")

</div>

Hi! Im trying to build mi own version o k6ChaiJs with one of these open api validators

- [chai-openapi-response-validator](https://www.chaijs.com/plugins/chai-openapi-response-validator/)
- api-contract-validator

But it was imposible to make it run correctly the build.  
I have followed the defined steps in this [post](https://community.grafana.com/t/how-to-build-plugins-for-chaijs/97010) but it didnt worked for me.  
Im almost sure there is a problem with index.ts file but i couldnt figure out what should i put there for each one of these plugins  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![joanlopez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/joanlopez/32/12328_2.png) [@joanlopez](https://community.grafana.com/u/joanlopez)\
**Post date:** [July 1, 2024, 10:41am UTC](https://community.grafana.com/t/k6-build-chaijs-with-openapi-validator/124931/3 "2024-07-01T10:41:47Z")

</div>

Hello @beagomezguillermo,

Welcome to the forum 🎉

I’ll try to reproduce your problem, but meanwhile, could you bring more details about the error you’re experiencing (error message, etc), please?

Thanks! 🙇‍♂️

---

<div class="post-metadata">

**Author:** ![beagomezguillermo](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@beagomezguillermo](https://community.grafana.com/u/beagomezguillermo)\
**Post date:** [July 3, 2024, 9:27am UTC](https://community.grafana.com/t/k6-build-chaijs-with-openapi-validator/124931/4 "2024-07-03T09:27:52Z")

</div>

The error is at compiling the k6ChaiJs in local env. The purpose of this is to ampliate the functionality of the library bringing me the option to use one of this plugins

- [chai-openapi-response-validator](https://www.chaijs.com/plugins/chai-openapi-response-validator/)
- api-contract-validator  
But it was imposible for me, the only error i get is that compile fails cause of require(‘api-contract-validator’).chaiPlugin;  
or  
// Import this plugin  
import chaiResponseValidator from ‘chai-openapi-response-validator’;  
// Load an OpenAPI file (YAML or JSON) into this plugin  
chai.use(chaiResponseValidator(‘path/to/openapi.yml’));  
which is necessary to use one of the plugins. Im cannot follow the Tutorial because that plugin used in there is much simplier than these two.  
I know it is cause of im not an expert in JS or TS  
Thanks in advance!
