microcks / microcks

The open source, cloud native tool for API Mocking and Testing. Microcks is a Cloud Native Computing Foundation sandbox project 🚀
https://microcks.io
Apache License 2.0
1.37k stars 213 forks source link

Is it possible to set the parameterConstraints as a metadata file #1371

Open andresionek91 opened 2 hours ago

andresionek91 commented 2 hours ago

Reason/Context

Is it possible to add header/parameter constraints via the metadata file like below?

---
apiVersion: mocks.microcks.io/v1alpha1
kind: APIMetadata
metadata:
  name: pet
  version: 1.0.0
  labels:
    domain: pets

operations:
  GET /pet:
    delay: 0
    dispatcher: FALLBACK
    dispatcherRules: |-
      {
        "dispatcher": "URI_PARAMS",
        "dispatcherRules": "petId",
        "fallback": "NOT FOUND"
      }
    parameterConstraints:
      - name: Authorization
        in: header
        required: true
        recopy: false
        mustMatchRegexp: "^Bearer\\s[a-zA-Z0-9\\._-]+$"

Description

I'm trying to set the constraints via a metadata file import, but it doesn't work. Is it possible to do it? If so, what's the syntax?

Implementation ideas

No response

github-actions[bot] commented 2 hours ago

👋 @andresionek91

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first issue here! Be sure to follow the issue template or please update it accordingly.

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Hope you have a great time there!