swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

Feature request: 'interfacePrefix'

Open inomn opened this issue 2 years ago • 5 comments
trafficstars

Hi! First of all thanks for this project!

Currently, there are several props for prefix\suffix settings:

typePrefix: '',
typeSuffix: '',
enumKeyPrefix: '',
enumKeySuffix: '',

But the one is missing is interfacePrefix (and interfaceSuffix).

Ideally, I want to have a "T" prefix for my types, and "I" for my interfaces, as far as I understand, currently it's impossible, and typePrefix will be applied to both types and interfaces.

Thanks!

inomn avatar Nov 29 '22 09:11 inomn

I'm trying override the ETA-templates but it has no effects. For example in type inheritance

chiralium avatar Dec 02 '22 16:12 chiralium

hi @js2me, what do you think about it?

inomn avatar Dec 10 '22 18:12 inomn

I'm trying override the ETA-templates but it has no effects. For example in type inheritance

@chiralium The template to override is data-contracts.ejs

const dataContractTemplates = {
  enum: (contract) => {
    return `enum ${contract.name} {\r\n${contract.content} \r\n }`;
  },
  interface: (contract) => {
    /**
     * Add your prefix/suffix here
     */
    return `interface I${contract.name} {\r\n${contract.content}}`;
  },
  type: (contract) => {
    return `type ${contract.name} = ${contract.content}`;
  },
}

whosdustin avatar Mar 30 '23 22:03 whosdustin

I'm trying override the ETA-templates but it has no effects. For example in type inheritance

@chiralium The template to override is data-contracts.ejs

const dataContractTemplates = {
  enum: (contract) => {
    return `enum ${contract.name} {\r\n${contract.content} \r\n }`;
  },
  interface: (contract) => {
    /**
     * Add your prefix/suffix here
     */
    return `interface I${contract.name} {\r\n${contract.content}}`;
  },
  type: (contract) => {
    return `type ${contract.name} = ${contract.content}`;
  },
}

This template override the interface definition, but not the extends part where super-interface has no prefix

chiralium avatar Mar 30 '23 22:03 chiralium

any news?

conexyit avatar Apr 06 '24 21:04 conexyit