Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: openapi et phone regexp ignorée
Browse files Browse the repository at this point in the history
alanlr committed Nov 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2475c41 commit f419f4e
Showing 2 changed files with 101 additions and 206 deletions.
301 changes: 98 additions & 203 deletions shared/helpers/openapi/__snapshots__/generateOpenapi.test.ts.snap
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@ exports[`generateOpenApiSchema > should generate proper schema 1`] = `
"phone": {
"description": "Le numéro de téléphone du contact de référence",
"example": "0X XX XX XX XX",
"pattern": "^0[1-9]\\\\d{8}$",
"type": [
"string",
"null",
@@ -1266,107 +1265,7 @@ exports[`generateOpenApiSchema > should generate proper schema 1`] = `
"type": "string",
},
"job": {
"allOf": [
{
"$ref": "#/components/schemas/Job",
},
{
"additionalProperties": false,
"properties": {
"contractDescription": {
"type": [
"string",
"null",
],
},
"contractType": {
"type": [
"string",
"null",
],
},
"creationDate": {
"type": [
"string",
"null",
],
},
"description": {
"type": [
"string",
"null",
],
},
"duration": {
"type": [
"string",
"null",
],
},
"dureeContrat": {
"type": [
"string",
"null",
],
},
"elligibleHandicap": {
"type": [
"boolean",
"null",
],
},
"id": {
"type": [
"string",
"null",
],
},
"jobStartDate": {
"type": [
"string",
"null",
],
},
"quantiteContrat": {
"type": [
"number",
"null",
],
},
"romeDetails": {
"$ref": "#/components/schemas/RomeDetail",
},
"rythmeAlternance": {
"type": [
"string",
"null",
],
},
"status": {
"enum": [
"Active",
"Pourvue",
"Annulée",
"En attente",
],
"type": [
"string",
"null",
],
},
},
"required": [
"description",
"creationDate",
"id",
"contractType",
],
"type": [
"object",
"null",
],
},
],
"$ref": "#/components/schemas/LbacJob",
},
"nafs": {
"items": {
@@ -1459,6 +1358,102 @@ exports[`generateOpenApiSchema > should generate proper schema 1`] = `
],
"type": "object",
},
"LbacJob": {
"additionalProperties": false,
"properties": {
"contractDescription": {
"type": [
"string",
"null",
],
},
"contractType": {
"type": [
"string",
"null",
],
},
"creationDate": {
"type": [
"string",
"null",
],
},
"description": {
"type": [
"string",
"null",
],
},
"duration": {
"type": [
"string",
"null",
],
},
"dureeContrat": {
"type": [
"string",
"null",
],
},
"elligibleHandicap": {
"type": [
"boolean",
"null",
],
},
"id": {
"type": [
"string",
"null",
],
},
"jobStartDate": {
"type": [
"string",
"null",
],
},
"quantiteContrat": {
"type": [
"number",
"null",
],
},
"romeDetails": {
"$ref": "#/components/schemas/RomeDetail",
},
"rythmeAlternance": {
"type": [
"string",
"null",
],
},
"status": {
"enum": [
"Active",
"Pourvue",
"Annulée",
"En attente",
],
"type": [
"string",
"null",
],
},
},
"required": [
"description",
"creationDate",
"id",
"contractType",
],
"type": [
"object",
"null",
],
},
"MetierEnrichi": {
"additionalProperties": false,
"properties": {
@@ -1728,107 +1723,7 @@ exports[`generateOpenApiSchema > should generate proper schema 1`] = `
"type": "string",
},
"job": {
"allOf": [
{
"$ref": "#/components/schemas/Job",
},
{
"additionalProperties": false,
"properties": {
"contractDescription": {
"type": [
"string",
"null",
],
},
"contractType": {
"type": [
"string",
"null",
],
},
"creationDate": {
"type": [
"string",
"null",
],
},
"description": {
"type": [
"string",
"null",
],
},
"duration": {
"type": [
"string",
"null",
],
},
"dureeContrat": {
"type": [
"string",
"null",
],
},
"elligibleHandicap": {
"type": [
"boolean",
"null",
],
},
"id": {
"type": [
"string",
"null",
],
},
"jobStartDate": {
"type": [
"string",
"null",
],
},
"quantiteContrat": {
"type": [
"number",
"null",
],
},
"romeDetails": {
"$ref": "#/components/schemas/RomeDetail",
},
"rythmeAlternance": {
"type": [
"string",
"null",
],
},
"status": {
"enum": [
"Active",
"Pourvue",
"Annulée",
"En attente",
],
"type": [
"string",
"null",
],
},
},
"required": [
"description",
"creationDate",
"id",
"contractType",
],
"type": [
"object",
"null",
],
},
],
"$ref": "#/components/schemas/LbacJob",
},
"nafs": {
"items": {
6 changes: 3 additions & 3 deletions shared/models/lbaItem.model.ts
Original file line number Diff line number Diff line change
@@ -138,8 +138,8 @@ const ZLbaItemContact = z
description: "Le nom du contact de référence",
})
.nullish(), // pe -> contact.nom | matcha -> prenom nom
phone: extensions
.phone()
phone: z
.string()
.openapi({
example: "0X XX XX XX XX",
description: "Le numéro de téléphone du contact de référence",
@@ -239,7 +239,7 @@ const ZLbaItemJob = z
status: z.enum(["Active", "Pourvue", "Annulée", "En attente"]).nullish(),
})
.strict()
.openapi("Job") // uniquement pour pe et matcha
.openapi("LbacJob") // uniquement pour pe et matcha

export type ILbaItemJob = z.output<typeof ZLbaItemJob>

0 comments on commit f419f4e

Please sign in to comment.